运行 start..run..wscript a.vbs a.bat 时出现问题
我有这 2 个文件 a.vbs 和 a.bat 每个文件只有一行。
a.vbs
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
a.bat
copy c:\blah\y.y c:\
当它工作时,它会在后台安静地运行 a.bat,从而进行文件复制。
我可以开始..运行...a.vbs a.bat 那行得通。 我可以打开命令提示符并执行 wscript a.vbs a.bat
但不起作用的是,
则此start...run...wscript a.vbs a.bat
如果我将 msgbox 放入 a.vbs 中, ,很明显可以运行。 但使用该方法时,a.bat 似乎没有运行。
为什么该表单不起作用?
I have these 2 files a.vbs and a.bat each has only one line.
a.vbs
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
a.bat
copy c:\blah\y.y c:\
When it works, it runs a.bat quietly in the background, which does the file copy.
I can do start..run...a.vbs a.bat
That works.
I can open a command prompt and do wscript a.vbs a.bat
But the thing that doesn't work, is this
start...run...wscript a.vbs a.bat
if I put an msgbox in a.vbs, it's clear that runs.
But it looks like a.bat doesn't run when using that method..
Howcome that form doesn't work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当 WScript.Arguments(0) 不是完整路径时,a.bat 需要位于当前目录中。
您可以通过以下方式检查当前目录:
如果 a.bat 始终与 a.vbs 位于同一文件夹中,则可以使用完整路径:
When WScript.Arguments(0) is not a full path, a.bat needs to be in the current directory.
You can check the current directory with:
If a.bat is always in the same folder as a.vbs, you can use a full path:
为什么你使用 vbscript 来调用 .bat?
开始 -->运行--> a.bat
如果您必须这样做,请执行
Start -->;运行--> cscript a.vbs a.bat
Why are you using a vbscript just to call a .bat?
Start --> Run --> a.bat
If you have to do it that way, do
Start --> Run --> cscript a.vbs a.bat