how to start process with different extension

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joedeene
    Contributor
    • Jul 2008
    • 579

    how to start process with different extension

    hi all,

    i want to start a process for an executable but with a different extension. like i want Process,start(" C:\myprocess.an yextension") to start as an executable but i dont know how to do it, the original extension is an executable but i want to change the extension and start is as an executable file, any help ? =)
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    I think you just *can*. At least when in cmd.exe you can
    I just copied an exe over to "wmi.fred" and typed it in and it ran fine?
    So "cmd /C wmi.fred"

    Comment

    • joedeene
      Contributor
      • Jul 2008
      • 579

      #3
      no, not in visual basic 2008, you cant just say

      process.start(f ilename.myownfi leextension)

      i read something about in the processstartinf o, like the option 'useshellexecut e'.

      but it said it is true by default where i read it, but i dont remember, uhm, but idk i know its possible...

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        You can certainly do it using the process class.
        Code:
        Process p = new Process();
        ProcessStartInfo psi = new ProcessStartInfo(@"C:\wmi.fred", "");
        psi.UseShellExecute = false;
        p.StartInfo = psi;
        p.Start();

        Comment

        • joedeene
          Contributor
          • Jul 2008
          • 579

          #5
          hey, plater, thanks a bunch, i knew it was something simple kinda, but im a little tired, haha. but ya it works for now, but im gonna put it to the test for something i want it to do, basically the same thing, but for a different purpose but thanks for all of your help, =)

          Comment

          Working...