Windows Universal App - launching CMD from an application

I am creating my first Win 10 app (in Visual C #) and had a quick question. (I'm a Java / Android guy)

I want to be able to run cmd line programs from my application. This will be a desktop app and I will need to shutdown, restart, lock, and abort the restart from within the application. I know I can use the Shutdown cmdlet, but how do I run it?

Thank!

+3


source to share


1 answer


Any program that you can run from the command line is a program that you can run without the command line. For example shutdown

; try to open the Run ( Win+ R) window and type:

shutdown /r /t 60

      



You will see Windows warning that the system will restart in 60 seconds ( shutdown /a

will abort the shutdown of course ). So you can just use Process.Start

to run the command. No need to run a full command line.

-3


source







All Articles