FOR /F "usebackq" %%i IN (`hostname`) DO SET MYVAR=%%i
SET subkey1=%random%%random%%random%%random%%random%%random%
SET subkey1=%subkey1:0=a%
SET subkey1=%subkey1:1=b%
SET subkey1=%subkey1:2=c%
wmic computersystem where caption="%MYVAR%" rename %subkey1%
This is block of code run in Windows BATCH
file, I'd like to adapt it for Python app but I can't think of a way to do so.
I've used:
os.system('cmd xxxx')
to run single line of code, but I don't think this will solve my issue with big block of code that can't be run separately.