I am trying to run a sequence of commands using the cmd command, the /k switch, and && to separate each command in the sequence.
For example, I would like to run this command to change to one folder, and then to the next:
cmd /k "cd C:\Program Files\Microsoft Office" && "cd C:\Program Files\Windows Mail"
But this doesn't work - it changes the folder only to Microsoft Office, and then stops.
How do I get this done?
Edit:
Actually, @seƱor-csmasmas is correct - my earlier example doesn't really demonstrate the problem.
The problem actually shows up when I run a command that has spaces in the path, followed by a command to change a directory.
For example, if you create a bat file which copies a file (let's call it copyfile.bat), and place the bat file in a folder with spaces, then call the cmd command like so:
C:\windows\system32\cmd.exe /k "C:\Test Folder\copyfile.bat" && "cd C:\Some Other Folder"
You will see that the current directory is not changed to C:\Some Other Folder.






