Search code examples
batch-filecmdcd

Start cmd.exe and change directory?


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?


Solution

  • 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.