-
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
-
How about changing the default dir before the Shell Command.
ex.
Code:
ChDir "C:\"
'//Your Shell Command Here
Post #512 - It made me Fanatic :D
-
Why don't you shell to a batch file?
-
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!