Open + Close .bat / .cmd

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sierra jones
    New Member
    • Oct 2010
    • 1

    Open + Close .bat / .cmd

    So guys, I was just wondering if there was a code I could get from anyone that would Open + Close a .bat or .cmd file? Not ALL .bat / .cmd files that are open, but just ONE (runserver.bat / runserver.cmd)

    Please post both codes seperately.

    Thanks,
    Sierra
    Last edited by sierra jones; Oct 9 '10, 11:31 PM. Reason: Forgot something :P
  • !NoItAll
    Contributor
    • May 2006
    • 297

    #2
    For a running application (including bat/cmd files)look at using:
    Code:
    Dim Instance as Process = Nothing
    Dim MyProcesses() as Process = Process.GetProcessesByName(YourProcess)
    
    For Each Instance in MyProcesses
     Instance.CloseMainWindow()
    Next
    To start a process then you can look at using:
    Code:
    System.Diagnostics.Process.Start(YourCMDfile.cmd)

    Comment

    Working...