I want to execute one command and assign it the value of a variable in a batch file.
We know that the host name command at the Windows command prompt gives the name of the PC. I want to use the hostname command and assign it a variable value in a batch file.
After searching it, I tried using the methods below, none of them work:
set CONTROLLER=hostname
set CONTROLLER=%hostname%
set CONTROLLER=%%hostname%%
set CONTROLLER=!hostname!
Please inform.
source
share