In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "DOS batch processing% cd% and% ~ dp0 what is the difference", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "what is the difference between% cd% and% ~ dp0 in DOS batch processing"!
In batch processing of DOS, it is sometimes necessary to know the current path. In DOS, there are two environment variables that can relate to the current path, one is% cd%, and the other is% ~ dp0.
The usage and representation of these two variables are different.
1.% cd% can be used in batch files or on the command line; when expanded, it is the drive letter: + current directory, such as entering the c:\ dir directory in the dos window
Enter: echo% cd%, it will be displayed as: C:\ dir.
The content of% cd% can be changed, which is the execution path of the command or the execution path of the batch file.
2.%~dp0 can only be used in batch files, it is determined by the directory location of the batch file in which it is located, and it is the drive letter: + path where the batch file is located. During the execution of this batch file, its expanded contents cannot be changed. For example, under disk D, there is a batch file, path.bat, which contains:
The code is as follows:
@ echo off
Echo this is cd%% cd%
Echo this is% ~ dp0% ~ dp0
Execute it under C:\ and E:\ respectively, and the output is:
Thank you for your reading, these are the contents of "what is the difference between% cd% and% ~ dp0 in DOS batches?" after the study of this article, I believe you have a deeper understanding of what the difference between% cd% and% ~ dp0 in DOS batches is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.