I need to run a command as part of my build workflow. Specifically, it is sc.exe with certain parameters like this:
sc.exe \\computerName STOP "serviceName"
In the build workflow, can I just use InvokeProcess activity to do this? I want to avoid batch files. Should I use InvokeProcess, and if so, do i have to provide the path to SC.exe. I would not think so because it's path is recognized no matter the working directory (i think because its a windows system executable).
Or should I do this another way?
You should be able to use the InvokeProcess
activity. Set the FileName
property to "sc.exe" and Arguments
to
String.Format("\\{0} STOP ""{1}""", ComputerName, ServiceName)
Assuming there are variables named ComputerName and ServiceName in scope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With