open command prompt window and change current working directory

后端 未结 7 933
时光说笑
时光说笑 2021-02-01 14:16

I\'m terribly new to scripting on windows. Using windows 7 64.

I\'m trying to make a .bat file that I can double click, and have it open a command prompt and automatical

7条回答
  •  执念已碎
    2021-02-01 14:36

    @ECHO OFF
    %comspec% /K "cd /D d:\somefolder"
    

    The /D will change folder and drive and works on 2000+ (Not sure about NT4)

    If you take a look at Vista's open command here, it uses cmd.exe /s /k pushd \"%V\" but I don't think %V is documented. Using pushd is a good idea if your path is UNC (\\server\share\folder) To get UNC current directory working, you might have to set the DisableUNCCheck registry entry...

提交回复
热议问题