open command prompt window and change current work

2019-03-12 04:30发布

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 automatically cd me to a certain directory.

I tried making a .bat file with

@ECHO OFF
cmd "cd C:\my\destination"

Which opens what looks like a command prompt, but doesn't seem to let me type any commands.

I then tried:

@ECHO OFF
start cmd "cd C:\my\destination"

But this just sent me into a loop opening tons and tons of prompts until my computer crashed :) The .bat file was located in the destination directory if that matters.

7条回答
女痞
2楼-- · 2019-03-12 05:09

You can create a batch file "go-to-folder.bat" with the following statements:

rem changes the current directory
cd "C:\my\destination"
rem changes the drive if necessary
c:
rem runs CMD
cmd
查看更多
登录 后发表回答