Launch WSH (*.js or *.vbs) file from C# Application.
-
Hi All! I'm working on a small personal project, hoping that it will eventually automate pretty much everything I do in Windows. But, the only thing I cannot find information regarding is how to launch a WindowsScriptHost (wsh) file from a c# application. For example: I have a form, and on that form is a button named "Copy File". Now I want to click that button and then have some c# code that will just simple run/launch that file that I specify. I am using JScript for WSH. Does any body have any ideas/pointers? Any help would be much appreciated. :) Regards, jt
j.t.
-
Hi All! I'm working on a small personal project, hoping that it will eventually automate pretty much everything I do in Windows. But, the only thing I cannot find information regarding is how to launch a WindowsScriptHost (wsh) file from a c# application. For example: I have a form, and on that form is a button named "Copy File". Now I want to click that button and then have some c# code that will just simple run/launch that file that I specify. I am using JScript for WSH. Does any body have any ideas/pointers? Any help would be much appreciated. :) Regards, jt
j.t.
You can use Process class to launch files programmatically.
Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion
-
You can use Process class to launch files programmatically.
Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion
Incase anybody else needs to know, I have the following code which launches my Jscript file once a buttonn is clicked:
private void button1_Click(object sender, EventArgs e)
{
Process CopyFile = new Process();
CopyFile.StartInfo.FileName = "C:\\Users\\jason\\Development\\Client\\Playground\\CopyFile.js";
CopyFile.StartInfo.Arguments = "ProcessStart.cs";CopyFile.Start();
}j.t.
-
Incase anybody else needs to know, I have the following code which launches my Jscript file once a buttonn is clicked:
private void button1_Click(object sender, EventArgs e)
{
Process CopyFile = new Process();
CopyFile.StartInfo.FileName = "C:\\Users\\jason\\Development\\Client\\Playground\\CopyFile.js";
CopyFile.StartInfo.Arguments = "ProcessStart.cs";CopyFile.Start();
}j.t.
If you don't need much control how the process runs you can also use static Start() method of Process class to launch application and pass argument.
Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion