相对路径问题(*.bat + VMWARE + Windows 2003)
这可能是 ServerFault 的问题,但我更感兴趣的是了解操作系统用来解析相对路径的方法。我有两个 Windows 2003 的 VMware 实例。我正在尝试运行一个批处理文件,该文件开始在其文件夹路径中运行另一个批处理文件。该脚本在一个虚拟机上运行良好,但在另一台虚拟机上无法执行并出现错误:
> The System cannot find the file specified
我尝试运行的脚本是 script.bat:
start /d FOLDERNAME /b /WAIT AnotherScript.bat %~n0%~x0
我已将两个文件放在同一文件夹结构中在两台机器上的 C:\ 驱动器下。文件 AnotherScript.bat 驻留在两个 VM 上的 FOLDERNAME 中。
这不是权限问题(?),因为我在两个虚拟机上都显示为管理员。
我想知道为什么我会在一台机器上无法解析相对路径,而在另一台机器上却能够解析相对路径。
谢谢
This may be a question for ServerFault but I was more interested in understanding the methodology that the OS uses to resolve relative paths. I have two VMware instances of Windows 2003. I am trying to run a batch file that starts running another batch file within its folder path. The script runs fine on one VM but on the other VM it fails to execute with the error:
> The System cannot find the file specified
The script I am trying to run is script.bat
:
start /d FOLDERNAME /b /WAIT AnotherScript.bat %~n0%~x0
I have put both my files within the same folder structure under the C:\ drive on both machines. The file AnotherScript.bat resides within FOLDERNAME on both the VMs.
It is not a permissions issue(?) since I show up as an administrator on both VMs.
I was wondering why would I get an unable to resolve relative paths on one machine vs. the ability to resolve it on another machine.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先检查两者启动的文件夹是否相同。在调用第二个脚本之前尝试添加
ECHO %CD%
以检查其启动的目录。同时检查第二个bat文件所在的路径是否在第一个虚拟机的
%PATH%
变量中设置。命令提示符在两个虚拟机中默认从哪里启动?
First check if the folder in which both are lauching are the same. Try adding
ECHO %CD%
before calling the 2nd script to check the directory in which it is getting launched.Also check if the path where the 2nd bat file resides is set in the
%PATH%
variable in the 1st VM.Where does command prompt start by default in both VMs?