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
InvokeProcessactivity. Set theFileNameproperty to “sc.exe” andArgumentstoAssuming there are variables named ComputerName and ServiceName in scope.