使用script.exe运行VB脚本 [英] run vb script using script.exe

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

问题描述

我想用Cscript.exe来运行VBScript文件。 我搜索了很多,但did'nt发现,而我可以用CMD在用CScript.exe运行我的脚本任何方式

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

这是我的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.");
            }

任何想法如何,我可以使用Cscript.exe

any idea how i can use cscript.exe

推荐答案

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

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";

这篇关于使用script.exe运行VB脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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