I'm working on a Windows machine and want to use subprocess to run several commands from the command line. <div><br></div><div>Normally with bat files or some of the other scripting languages on Windows, I would set up a variable with the path to the command like so:</div>
<div><br></div><div>gpg = 'c:/program files (x86)/gnu/gnupg/gpg2.exe'</div><div><br></div><div>Then call the command the variable to avoid typing in the full path.</div><div><br></div><div>When I do this with subprocess it works:</div>
<div><br></div><div>subprocess.Popen('c:/program files (x86)/gnu/gnupg/gpg2.exe', shell=True)</div><div><br></div><div>However when I do this:</div><div><br></div><div>gpg = 'c:/program files (x86)/gnu/gnupg/gpg2.exe'</div>
<div><br></div><div>subprocess.Popen('gpg', shell=True)</div><div><br></div><div>It fails to run gpg and is not expanding the variable. Is there a way to do this that I'm missing?<br><br>Becky </div>