Changing default startup directory for command pro

2019-01-08 06:31发布

How do I change default startup directory for command prompt in Windows 7?

I usually do the following to start command prompt from C:\

  WIN-R (Run Prompt)
  cmd /K cd C:\

I want to do the following to start command prompt from C:\

  WIN-R (Run Prompt)
  cmd

18条回答
趁早两清
2楼-- · 2019-01-08 06:32

This doesn't work for me. I've tried this both under Win7 64bit and Vista 32.

I'm using the below commandline to add this capability.

reg add "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d "IF x"%COMSPEC%"==x%CMDCMDLINE% (cd /D c:)"

查看更多
放荡不羁爱自由
3楼-- · 2019-01-08 06:33

While adding a AutoRun entry to HKEY_CURRENT_USER\Software\Microsoft\Command Processor like Shinnok's answer is the way to go it can also really mess things up, you really should try to detect a simple cmd.exe startup vs a script/program using cmd.exe as a child process:

IF /I x"%COMSPEC%"==x%CMDCMDLINE% (cd /D c:\)
查看更多
老娘就宠你
4楼-- · 2019-01-08 06:33

changing shortcut under Windows System on 8.1 worked for me - another thing I found is that 'Start In:' WORKS when Advanced -> Run as admin is UNCHECKED, however, if CHECKED, it does not work

查看更多
放我归山
5楼-- · 2019-01-08 06:34

HKEY_CURRENT_USER\Software\Microsoft\Command Processor

string: Autorun value: cd /d %~dp0

all bat files will run from the bat file location

查看更多
一纸荒年 Trace。
6楼-- · 2019-01-08 06:36

Open regedit and browse to this path

HKEY_CURRENT_USER\Software\Microsoft\Command Processor

Create new string vale named Autorun. Set its value to cd /d C:\.

Run cmd again. Voila!

查看更多
混吃等死
7楼-- · 2019-01-08 06:36
  1. go to regedit ( go to search and type regedit)
  2. expand "HKEY_CURRENT_USER" node
  3. under HKEY_CURRENT_USER node expand "software" node
  4. under software node expand "microsoft" node
  5. under microsoft node click on "Command Processor"
  6. path looks like this : "HKEY_CURRENT_USER\Software\Microsoft\Command Processor"

it looks something like this :

  1. if you do not see "Autorun" String Value
  2. Right Click - New - Expandable String Value, and rename it to Autorun
  3. double click on "Autorun" 10.enter this value path format:
  4. "CD/d C:\yourfoldername\yoursubfoldername"
查看更多
登录 后发表回答