Start cmd.exe and change directory?

jerryh91 picture jerryh91 · Jun 28, 2012 · Viewed 23.1k times · Source

I'd like a .bat file which is stored on the desktop to perform 2 simple tasks: 1. Start cmd.exe 2. Change directory to c:\executionsdktest_10.2.2 I have:

 @echo off 
 start cmd.exe \k
 cdsdad c:\ExecutionSDKTest_10.2.2

But when I double click the .bat file, this starts cmd.exe but cd to c:\users\qestester\desktop. ANy ideas?

Answer

Joey picture Joey · Jun 28, 2012

You can use

cmd /k "cd /d c:\ExecutionSDKTest_10.2.2"

And you wouldn't need a batch file for that. This can be put in a normal shortcut.

And if you have a normal shortcut you can just specify its working directory and run cmd directly without any arguments.