My code:
file = open("crash_reports_envs.txt")
envVariables=file.read()
print(envVariables)
file.close()
os.environ['linuxwdir'] = (re.search("linuxwdir:(\S+)",envVariables).group(1))
os.environ['invertwdir']= (re.search("wdir:(\S+.*)\\n",envVariables).group(1))
I am setting these environment variables in the script and running a batch file file1
from the same script, I have another file1
in same folder where the script is. How I can use these variables in that batch file? Right now the batch file does not recognize these variables.
The way you use environment variables in .bat files is to surround them with %, for example %linuxwdir%. If I understand your .bat
file correctly, you need something like this (untested):
cd "C:\Program Files (x86)\PuTTY"
pscp.exe -pw "pswd" "%invertwdir%/file2" uname@execServer:%linuxwdir%/file2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.