net use in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • khaing
    New Member
    • Apr 2010
    • 5

    net use in c#

    hello,
    i'm a new programmer so please understand if my question is too easy.
    What's the meaning of /c in following statements which is discussed in "System.Diagnos tics.ProcessSta rtInfo to start a session" article.
    Code:
    public void InitiateSession(string server,string userName, string passWd
    )
    {
    //To start the command
    System.Diagnostics.ProcessStartInfo psi = new
    System.Diagnostics.ProcessStartInfo();
    psi.FileName = @"C:\WINDOWS\system32\cmd.exe"; // Path for the cmd
    prompt
    psi.Arguments = @"[B]/c[/B] net use \\servername\IPC$ /USER:domain\user
    password"; // Arguments for the command prompt
    psi.WindowStyle =System.Diagnostics.ProcessWindowStyle.Hidden; //
    Hide the window
    System.Diagnostics.Process p =
    System.Diagnostics.Process.Start(psi);//Run
    }
    Last edited by tlhintoq; Apr 19 '10, 03:56 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • MrMancunian
    Recognized Expert Contributor
    • Jul 2008
    • 569

    #2
    The /c-parameter means that it executes the command and then exits.

    Steven

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      TIP: When you first created your question you were asked to wrap your code with [code] tags.
      [imgnothumb]http://files.me.com/tlhintoq/10jihf[/imgnothumb]
      It really does help a bunch. Look how much easier it is to read now that someone has done it for you. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

      Comment

      • stoogots2
        New Member
        • Sep 2007
        • 77

        #4
        Just a suggestion that you may want to use this method vs opening a dos window and issuing the "net use" command.

        Comment

        Working...