Windows 中的命令 cd/d %~dp0 是什么意思 [英] What does it mean by command cd /d %~dp0 in Windows
本文介绍了Windows 中的命令 cd/d %~dp0 是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能帮我理解命令 cd/d %~dp0
及其用途.再次 dos 命令在下面
Can someone please help me to understand the command cd /d %~dp0
and its purposes. Again dos command is below
cd /d %~dp0
请帮助我理解它的含义.
Please help me to get the meaning of it.
推荐答案
我们来剖析一下.分为三部分:
Let's dissect it. There are three parts:
cd
-- 这是更改目录命令./d
-- 此开关使cd
一次更改驱动器和目录.没有它你将不得不做cd %~d0 &cd %~p0
.(%~d0
更改活动驱动器,cd %~p0
更改目录).%~dp0
-- 这可以进一步分解为三个部分:
cd
-- This is change directory command./d
-- This switch makescd
change both drive and directory at once. Without it you would have to docd %~d0 & cd %~p0
. (%~d0
Changs active drive,cd %~p0
change the directory).%~dp0
-- This can be dissected further into three parts:
%0
-- 这表示批处理脚本的第零个参数.它扩展为批处理文件本身的名称.%~0
--~
在扩展参数周围去掉双引号 ("
).%dp0
--d
和p
有扩展的修饰符.d
强制添加驱动器号,p
添加完整路径.
%0
-- This represents zeroth parameter of your batch script. It expands into the name of the batch file itself.%~0
-- The~
there strips double quotes ("
) around the expanded argument.%dp0
-- Thed
andp
there are modifiers of the expansion. Thed
forces addition of a drive letter and thep
adds full path.
这篇关于Windows 中的命令 cd/d %~dp0 是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文