Dos - Get service info

By xngo on November 28, 2019

The following command line with get the service information about Windows Time service.

FOR /f "tokens=3" %A in ('sc queryex w32time ^| find "PID"') do (
    wmic service where "ProcessID=%A" get caption,name,processid /value
)

Output

Caption=Windows Time
Name=W32Time
ProcessId=1464

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.