使用UNC运行批处理文件 [英] Run Batch File using UNC

查看:155
本文介绍了使用UNC运行批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我整天都在寻找设法做到这一点的方法.我需要运行服务器上保存的批处理文件,文件路径以DOS不喜欢的IP地址开头.因此,我发现了pushd命令,该命令分配了一个临时驱动器号,您可以从中运行批处理文件.

如果我只是运行普通程序或文件,我将使用:

Hi
I have been looking all day trying to find a way to do this. I need to run a Batch file which is held on a server, the file path begins with a IP Address which DOS doesn''t like. So i found the pushd command which assigns a temp drive letter from which you can run the Batch File.

If i was simply running a normal program or file i would use:

Dim proc As Process    <br />
proc = Process.Start("c:\BatchFile.bat")   <br />
proc.WaitForExit()



但是我的文件路径是\\ 10.10.10.1 \ Public \ Folder \ BatchFile.bat

如果我键入
,则从命令提示符运行
推入\\ 10.10.10.1 \ Public \ Folder \(Enter)
BatchFile.bat

批处理文件运行正常,但是我需要能够在VB.NET中执行此操作,并且主程序仍需要等待批处理文件运行并且cmd提示关闭才能继续.

任何建议都是很好的,或者如果我对这个解释不够好,请告诉我

谢谢



but my file path is e.g. \\10.10.10.1\Public\Folder\BatchFile.bat

running from a command prompt if i type

pushd \\10.10.10.1\Public\Folder\ (Enter)
BatchFile.bat

the Batch File runs fine, but i need to be able to do this from within VB.NET and the main program still needs to wait for the batch file to run and the cmd prompt to close before continuing.

Any suggestions would be excellent or if i haven''t explained this well enough let me know

Thanks

推荐答案

您是否尝试过:

Have you tried:

Dim proc as Process = Process.Start("\\10.10.10.1\Public\Folder\BatchFile.bat")
proc.WaitForExit()


您可以将其与处理PUSHD位的本地批处理文件一起使用,然后调用远程文件.

例如
You could get this to work with a local batch file that does the PUSHD bit and then calls the remote file.

e.g.
SET REMOTEPATH=\\10.10.10.1\Public\Folder
PUSHD %REMOTEPATH%
  CALL BatchFile.bat
POPD



艾伦.



Alan.


这篇关于使用UNC运行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆