Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Launch WSH (*.js or *.vbs) file from C# Application.

Launch WSH (*.js or *.vbs) file from C# Application.

Scheduled Pinned Locked Moved C#
tutorialcsharpjavascripthelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jas0n23
    wrote on last edited by
    #1

    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.

    G 1 Reply Last reply
    0
    • J jas0n23

      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.

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      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

      J 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        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

        J Offline
        J Offline
        jas0n23
        wrote on last edited by
        #3

        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.

        G 1 Reply Last reply
        0
        • J jas0n23

          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.

          G Offline
          G Offline
          Giorgi Dalakishvili
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups