System.Diagnostics.Process support for calling vbs file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I am tring to call a .vbs file using System.Diagnostics.Process class with
following code.

Process objProcess = new Process();
objProcess.StartInfo.FileName = "C:\\testScript.vbs";
objProcess.StartInfo.Arguments ="1 2 test2.txt";
objProcess.Start();
objProcess.WaitForExit();

It is blowing up on executing the code,
althought the vbs script file is working fine on running indivually.

Any help is appriciated.

Thanks and Looking Forward,
Rupali
 
What do you mean by "blowing up" ?

My first thought would be something related to security (is this the same
security context ? anti-virus software ? etc...)
 
Works fine from here. What problem or error are you getting?

Dim obj_process As New System.Diagnostics.Process
With obj_process
.StartInfo.FileName = "C:\\testScript.vbs"
.StartInfo.Arguments = "1 2 test2.txt"
.Start()
.WaitForExit()
End With

------------ testScript.vbs --------------
msgBox "TEST"

Bryan Martin
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top