我想访问一个具有正确路径的文件,如
"C:\Win10 10 LTSC GOA 2022-04\步骤3-安装Adobe DC\Installer\Full_Setup_adobe_DC.bat“
我的批处理文件存储在同一个目录中,但文件夹不同:"C:\Win10 10 LTSC GOA 2022-04\批“
在批量编写代码时,我使用
start "" "%~dp0Step 3 - Install Adobe Reader DC\Installer\Full_Setup_adobe_DC.bat"
错误对话框显示错误路径。
"C:\Win10 10 LTSC GOA 2022-04\批\步骤3-安装Adobe DC\Installer\Full_Setup_adobe_DC.bat“
在这种情况下,应该使用什么正确的语法%~D0 0,%~d0?
发布于 2022-11-02 06:17:05
My batch file is stored in same directory but different folder : "C:\Win10 LTSC GOA 2022-04\Batches"
“文件夹”是命令行挑战的“目录”使用的名称。
%~dp0
和%~DP0
是等价的。批处理命令在很大程度上不区分大小写,但for
语句中的for %%x
和for %%X
除外(for %%x
和for %%X
指不同的元数据,不可互换)。
%~dp0
的意思是the **d**rive and **p**ath of the **current** directory.
%d0‘,意思是drive。我想这是你问题中的一个错误。
start "" "C:\Win10 LTSC GOA 2022-04\Batches\Full_Setup_adobe_DC.bat"
应该可以工作,但是由于您的起始目录是C:\Win10 LTSC GOA 2022-04\Batches
,所以%~dp0
被解析为C:\Win10 LTSC GOA 2022-04\Batches\
,并附加了Step 3 - Install Adobe Reader DC\Installer\Full_Setup_adobe_DC.bat
--给您报告的“找不到”消息。
https://stackoverflow.com/questions/74284367
复制相似问题