dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] Shell to CMD.exe problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    869

    Resolved [RESOLVED] Shell to CMD.exe problem

    I have following sample code which works fine.

    Code:
    Shell "C:\Users\Alan\desktop\CMD.exe /k dir", vbNormalFocus
    But I have modified CMD.exe (via the shortcut, properties, colours) to show a white background and purple text. But the above code brings up the CMD window with the default black and white.

    I'd like to incorporate my (or any other) colour setting into the shell command, and would like to know how, simply...
    Thanks all!

  2. #2
    Hyperactive Member
    Join Date
    Aug 2017
    Posts
    308

    Re: Shell to CMD.exe problem

    Code:
    C:\>COLOR /?
    Sets the default console foreground and background colors.
    
    COLOR [attr]
    
      attr        Specifies color attribute of console output
    
    Color attributes are specified by TWO hex digits -- the first
    corresponds to the background; the second the foreground.  Each digit
    can be any of the following values:
    
        0 = Black       8 = Gray
        1 = Blue        9 = Light Blue
        2 = Green       A = Light Green
        3 = Aqua        B = Light Aqua
        4 = Red         C = Light Red
        5 = Purple      D = Light Purple
        6 = Yellow      E = Light Yellow
        7 = White       F = Bright White
    
    If no argument is given, this command restores the color to what it was
    when CMD.EXE started.  This value either comes from the current console
    window, the /T command line switch or from the DefaultColor registry
    value.
    
    The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
    the COLOR command with a foreground and background color that are the
    same.
    
    Example: "COLOR fc" produces light red on bright white
    Code:
    Shell Environ$("ComSpec") & " /K COLOR 75 & DIR", vbNormalFocus

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2012
    Posts
    869

    Re: Shell to CMD.exe problem

    Thanks heaps. I now have
    Code:
    Shell "CMD.exe /k color 75 & dir", vbNormalFocus
    Now on to less trivial stuff in the CMD line...
    Thanks all!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width