繁体   English   中英

windows .BAT错误系统找不到指定的路径

[英]windows .BAT Error The system cannot find the path specified

for /F "tokens=*" %%a in ('dir /od /b %* ^| tail -n 1') do SET MY_T2=%%a

echo %MY_T2%

在Windows 7企业命令提示符终端中运行上述.bat文件

c:\tools>t2.bat

c:\tools>for /F "tokens=*" %%a in ('dir /od /b ^| tail -n 1') do SET MY_T2=%%a
The system cannot find the path specified.

c:\tools>SET MY_T2=t2.bat

c:\tools>echo t2.bat
t2.bat

为什么会出现错误“系统找不到指定的路径”。

如果更改上面的.bat文件,以便将输出重定向到文件,然后从重定向的输出文件设置变量,则不会出现上述错误。

c:\tools>t1.bat

c:\tools>dir /od /b    | ttail -n 1  1>g:\t1.txt

c:\tools>set /p MY_T1= 0<g:\t1.txt

c:\tools>echo t1.bat
t1.bat

c:\tools>

我如何解决错误而不被迫将命令输出重定向到文件?

我之前已将clink作为命令提示符的插件添加到cmd。 最近,我删除了clink的目录,但没有卸载它-导致cmd.exe仍在搜索它。 由于cmd.exe找不到链接,因此出现错误“系统找不到指定的路径”。

这说明了一切。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM