Results 1 to 5 of 5

Thread: including arguments with System.Diagnostics.Process.Start.... [resolved]

  1. #1

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Resolved including arguments with System.Diagnostics.Process.Start.... [resolved]

    I can do
    VB Code:
    1. System.Diagnostics.Process.Start("C:\windows\system32\shutdown.exe")
    but this returns a file not found error
    VB Code:
    1. System.Diagnostics.Process.Start("C:\windows\system32\shutdown.exe -r")
    How do I include the switches at the end of the file name when using Process.Start?
    thanks
    kevin
    Last edited by kebo; Mar 31st, 2005 at 12:48 PM.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  2. #2
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Bath, England
    Posts
    411

    Re: including arguments with System.Diagnostics.Process.Start command line exe

    Create a process object, then fill in the ProcessInfo data and start it that way. I don't have the compiler here but you need something like this:

    VB Code:
    1. Dim pShutdown as Process
    2. pShutdown.ProcessInfo.???     '<<< Don't know what it's called, but it's in there somewhere
    3. pShutdown.Start

  3. #3

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: including arguments with System.Diagnostics.Process.Start command line exe

    thanks
    here's what I got:
    VB Code:
    1. Dim p As New Process
    2.         p.StartInfo.FileName = "C:\windows\system32\shutdown.exe -r"
    3.         p.Start()
    but I get the same result:
    The system cannot find the file specified
    anyone/anything else?????
    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  4. #4
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Bath, England
    Posts
    411

    Re: including arguments with System.Diagnostics.Process.Start command line exe

    There should be another member of "StartInfo" that controls the command line arguments called "Arguments" or something similar. You need to add:

    VB Code:
    1. p.StartInfo.Arguments = "-r"

    to the code above, and remove the argument from the filename property. It should look like this:

    VB Code:
    1. Dim p As Process
    2. p.StartInfo.Filename = "C:\windows\system32\shutdown.exe"
    3. p.StartInfo.Arguments = "-r"
    4. p.Start

  5. #5

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: including arguments with System.Diagnostics.Process.Start command line exe

    that's the ticket. thanks
    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width