Results 1 to 4 of 4

Thread: Changing the command line in dos

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Charleston, S.C.
    Posts
    21
    Does anyone know how to change the command line after opening a dos prompt from the shell command? I want to change the directory in the dos window to just C:\ and whenever I open a dos window with the shell command it is at the current working directory by default.

    I have tried the sendkeys command from several different sources but the best I have been able to get with this is a "dump" of what looks like registry keys and then the system gets completely hosed (Oops!).

    Any help would be appreciated.

    Jason Ferreira

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    How about changing the default dir before the Shell Command.
    ex.
    Code:
    ChDir "C:\"
    '//Your Shell Command Here
    Post #512 - It made me Fanatic

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Why don't you shell to a batch file?
    Chemically Formulated As:
    Dr. Nitro

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Or you can do it this way:
    Code:
    Private Sub ShellToRoot()
        Dim sCmd As String
    
        sCmd = Environ("COMSPEC") & " /k cd c:\"
        Shell sCmd, vbNormalFocus
    End Sub
    I use the COMSPEC environment variable to find out the location of COMMAND.COM or CMD.EXE file.

    Good luck!

Posting Permissions

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



Click Here to Expand Forum to Full Width