Run python elevated from dos env

There is this nice script to register the default python exe
It is used to run a python package install file, e.g. PIL in a virtualenv.

I can use it manually by starting a console2 command prompt and switch to the needed virtualenv with the command

workon myenv

Then I run:

python the_python.py

Now the script sets the current python executable to the registered python and the install file uses the path of the virtualenv.

I'd like to create a button to do these two steps for me.
I got this far:

cd {sourcepath$} copy "C:\myscripts\the_python.py" HERE WHENEXISTS=replacenewer call workon {sourcepath$|nopath|noterm} # virtualenv name = dir name @admin:python reg_python.py @leavedoswindowopen

Only, it does not work. I get: WindowsError: [Error 5] Access is denied, because the script tries to change the windows registry.

How do I do this right?

Try elevating the entire command:

@admin cd {sourcepath$} copy "C:\myscripts\the_python.py" HERE WHENEXISTS=replacenewer call workon {sourcepath$|nopath|noterm} # virtualenv name = dir name python reg_python.py @leavedoswindowopen

Works. You're the best.

b.t.w.: I mixed up 'the_python.py' and 'reg_python.py'. It is the same file.