当从另一个W2012服务器访问从W2k12服务器托管的脚本文件时,CMD在评估%〜参数时挂起。执行相同文件CMD的W2008服务器上的OTOH不会挂起。通过网络访问文件的所有服务器都获得相同的GPO,并且正在使用相同的域管理员帐户访问脚本文件。
这是我的测试环境:
这是一个测试脚本,通过资源管理器双击启动:
@ECHO OFF
SETLOCAL
ECHO Testcase is starting
ECHO This Script is called %~nx0 and
ECHO it resides in the directory %~dp0
PAUSE
服务器B或服务器C上的输出,通过 Z:\ path
访问脚本文件Testcase is starting
This Script is called testcase.cmd and
it resides in the directory Z:\path\
Press any key to continue . . .
服务器B上的输出,通过 \\ ServerA \ share \ path
访问脚本文件'\\ServerA\share\path'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Testcase is starting
This Script is called testcase.cmd and
it resides in the directory \\ServerA\share\path
Press any key to continue . . .
服务器C上的输出,通过 \\ ServerA \ share \ path
访问脚本文件'\\ServerA\share\path'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Testcase is starting
**这就是它! **
在评估CMD脚本中的FOR循环中的%〜参数时也会出现同样的情况:
FOR %%a IN (\\ServerA\share\path\*.cmd) DO ECHO %%~nxa
在DOS窗口中手动执行时只有%a。
有没有人见过这个,并且可能找到了解决方案? 提前谢谢!