I. Preface
The default directory of CMD is always the current user directory, and then a large CD command is used to enter the working directory. Fortunately, we can enter the specified directory through the batch processing file, which is much easier.
II. Introduction to cmd commands
CMD [/A |/u] [/q] [/d] [/E: On |/E: Off] [/F: On |/F: off] [/V: On |/V: off] [[/S] [/c |/K] string]/C: Execute the command specified by the string and then terminate the command./K: Execute the command specified by the string, but keep/s in/C or/K and then modify the string for processing (see below) /Q close response/d stop executing the autorun command from the Registry (see below) /A converts the output to the internal pipeline or file command to ANSI/U, and the output to the internal pipeline or file command to Unicode/T: FG to set the foreground/background color (details, see color /?) /E: On enable command extension (see below)/E: Off disable command extension (see below)/F: On enable file and directory name completion characters (see below)/F: off stop file and directory name completion characters (see below)/V: On will! Start and delay environment variable extension as a separator. For example,/V: On will allow! VaR! Allowed during execution! VaR! Extension variable VAR. The VaR syntax extends variables when input, which is different from in a for loop. /V: Off disables delayed environment extension.
3. Key of the default directory in the Registry
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ\REG_EXPAND_SZ
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun\REG_SZ\REG_EXPAND_SZ
The default directory entered by the CMD command is recorded in the above two keys. Some systems have only one of them, and some systems have both. If both are available, the second one prevails.
4. Write a batch together!
Test. bat
cmd /k cd /d f:\test
Click the test. BAT file. The current directory in the command line window is F: \ test!
V. References
Http://blog.csdn.net/yyh1988923/article/details/7564961
Respect Original, reprinted please indicate from: http://www.cnblogs.com/fsjohnhuang/p/3962922.html ^_^ fat Zi John
CMD magic Hall: cmd enters the specified directory