extending PATH on Windows?

Ulli Horlacher framstag at rus.uni-stuttgart.de
Wed Feb 17 17:37:29 EST 2016


eryk sun <eryksun at gmail.com> wrote:

> >> The AutoRun command (it's a command line, not a script path)
> >
> > A script path is a legal command line, too.
> 
> If the registry value were just a script path, you'd have to modify
> your script to chain to the previous script, if any. Since it's a
> command line you can simply use the & operator to append another
> command.

This is the better way, no question. I will change it.


> Do you really intend for your batch file to be run every time cmd.exe
> is executed, including every time that every program on the machine
> calls the CRT system() function?

Yes. It just extends PATH, it should not do any harm.


> Why don't you just install a shortcut to a batch file that starts a
> command prompt with the extended PATH?

Hmm... how does a user starts this shortcut, when it is not found in PATH?


> system('reg...') won't be able to do that unless you export the key to
> a .reg file and parse the existing AutoRun value. It would be simpler
> to use subprocess.check_output('reg query ...')

I do it this way, already.


> but simpler still and more reliable to just call QueryValueEx.

I find it more complicated.

-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum IZUS/TIK         E-Mail: horlacher at tik.uni-stuttgart.de
Universitaet Stuttgart         Tel:    ++49-711-68565868
Allmandring 30a                Fax:    ++49-711-682357
70550 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/



More information about the Python-list mailing list