Skip to main content

I am trying to write a batch script that savesaves the result of a command in a variable. so after I can use it later.

For example I am tryin to run this on the script: sc queryex "Service" |find /i "pid"

but I want to save this result in a variable.

set PIDRS=sc queryex "Themes" |find /i "pid" ECHO "%PIDRS%

set PIDRS=sc queryex "Themes" |find /i "pid" ECHO "%PIDRS% 

Any Ideas?

I am trying to write a batch script that save the result of a command in a variable. so after I can use.

For example I am tryin to run this on the script: sc queryex "Service" |find /i "pid"

but I want to save this result in a variable.

set PIDRS=sc queryex "Themes" |find /i "pid" ECHO "%PIDRS%

Any Ideas?

I am trying to write a batch script that saves the result of a command in a variable. so I can use it later.

For example I am tryin to run this on the script: sc queryex "Service" |find /i "pid"

but I want to save this result in a variable.

set PIDRS=sc queryex "Themes" |find /i "pid" ECHO "%PIDRS% 

Any Ideas?

Source Link

Save the result of a command in variable, Windows batch

I am trying to write a batch script that save the result of a command in a variable. so after I can use.

For example I am tryin to run this on the script: sc queryex "Service" |find /i "pid"

but I want to save this result in a variable.

set PIDRS=sc queryex "Themes" |find /i "pid" ECHO "%PIDRS%

Any Ideas?