问题
I want to run vbscript file using cscript.exe. i searched a lot but did'nt found any way while i can run my script using cmd with cscript.exe
this is my code
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.");
}
any idea how i can use cscript.exe
回答1:
You should set the FileName property to the executable you want to run. In your case that would be cscript.exe
and not testing
:
p.StartInfo.Arguments = @"""C:\Program Files\VDIWorkLoad\WorkLoadFile\open test.vbs""";
p.StartInfo.FileName = @"C:\Windows\System32\cscript.exe";
来源:https://stackoverflow.com/questions/8850834/run-vb-script-using-script-exe