Hack Forums
[.NET] Wait for Program to finish in Commandline? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Wait for Program to finish in Commandline? (/showthread.php?tid=5528997)



Wait for Program to finish in Commandline? - Haters Ganna Hate - Jan 20, 2017

I want my program to do a command in the commandline, then wait till that command finishes and it jumps back to CMD asking for the next command.

How would I do that?


* - Annabelle Lee - Jan 20, 2017

Well in order to create a command line and execute a command in it, you can try using Process.Start.


* - Barret - Jan 20, 2017

(Jan 20, 2017 10:14 AM)AnnabelleLee Wrote:  Well in order to create a command line and execute a command in it, you can try using Process.Start.

yup what he said, if i recall the process class has this method that would block the current thread until it was exited.

Code
dim p as process = Process.Start("path\to\app.ex")
p.WaitForExit()


I might be wrong but this should be it


* - Annabelle Lee - Jan 20, 2017

(Jan 20, 2017 10:22 AM)GrimEdittion Wrote:  yup what he said, if i recall the process class has this method that would block the current thread until it was exited.

Code
dim p as process = Process.Start("path\to\app.ex")
p.WaitForExit()


I might be wrong but this should be it

You should have a second argument to it, which will be the commands to run.

Code
Process.Start("path\to\app.exe", "command here")