CMD magic Hall: cmd enters the specified directory

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.