簡體   English   中英

使用script.exe運行vb腳本

[英]run vb script using script.exe

我想使用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

您應該將FileName屬性設置為要運行的可執行文件。 在您的情況下,這將是cscript.exe而不是testing

p.StartInfo.Arguments = @"""C:\Program Files\VDIWorkLoad\WorkLoadFile\open test.vbs""";
p.StartInfo.FileName = @"C:\Windows\System32\cscript.exe";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM