Opening a DOS window with some path

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aads
    New Member
    • Mar 2008
    • 48

    Opening a DOS window with some path

    Hi there,

    Can anyone tell me how to open a DOS window from a VB.NET app pointing to my own path which I pass as a parameter. For ex: I want the DOS window to be opened with D:\TestBed\MyAp p\. All I want to know is how do I pass the path "D:\TestBed\MyA pp" to the DOS window.

    Thanks in advance,
    Aads
  • Enij
    New Member
    • Apr 2009
    • 13

    #2
    Hi,

    I found this works:

    Code:
    System.Diagnostics.Process.Start("cmd", "/k cd\test")
    where 'cd\test' navigates to the folder you want to start in. (using VB.net 2003 Standard Ed. with Windows XPsp2)

    EDIT:

    You can also use:
    Code:
    System.Diagnostics.Process.Start("cmd", "/k h: && cd\test")
    after /k you can write additional arguments separated by 2 ampersands - the above example takes me to my H: drive and changes the folder to H:\TEST\

    Comment

    • Aads
      New Member
      • Mar 2008
      • 48

      #3
      Cheers buddy - that solved my problem.

      Thanks,
      Aads

      Comment

      Working...