0

我想使用 cscript.exe 运行 vbscript 文件。我搜索了很多,但没有找到任何方法,而我可以使用带有 cscript.exe 的 cmd 运行我的脚本

这是我的代码

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

4

1 回答 1

1

您应该将 FileName 属性设置为要运行的可执行文件。在你的情况下,这将是cscript.exe而不是testing

p.StartInfo.Arguments = @"""C:\Program Files\VDIWorkLoad\WorkLoadFile\open test.vbs""";
p.StartInfo.FileName = @"C:\Windows\System32\cscript.exe";
于 2012-01-13T12:51:30.377 回答