I want to execute one command and assign it's value to a variable within a batch file.
We know that running hostname command on a windows command prompt gives the PC name. I want to use hostname command and assign it's value to a variable within a batch file.
After googling about it, I've tried using below methods, none of these seem to work:
set CONTROLLER=hostname
set CONTROLLER=%hostname%
set CONTROLLER=%%hostname%%
set CONTROLLER=!hostname!
Kindly advise.