使用script.exe运行vb脚本
我想使用cscript.exe运行vbscript文件。 我搜索了很多,但没有找到任何方式,而我可以使用cmd与cscript.exe运行我的脚本
这是我的代码
Process p = new Process(); p.StartInfo.Arguments = @"C:\\Program Files\\VDIWorkLoad\\WorkLoadFile\\open test.vbs"; p.StartInfo.FileName = "testing"; p.StartInfo.UseShellExecute = false; try { p.Start(); p.WaitForExit(); Console.WriteLine("Done."); }
任何想法如何使用cscript.exe
您应该将FileName属性设置为要运行的可执行文件。 在你的情况下,这将是cscript.exe
而不是testing
:
p.StartInfo.Arguments = @"""C:\Program Files\VDIWorkLoad\WorkLoadFile\open test.vbs"""; p.StartInfo.FileName = @"C:\Windows\System32\cscript.exe";