0

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 Answer 1

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";
Sign up to request clarification or add additional context in comments.

1 Comment

can you guide me when i try to run my script using system.diagnostic.start(path); it works fine but when try to execute using window service it does'nt work any idea?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.