[Tutor] How to make a python script run on startup

eryksun eryksun at gmail.com
Tue Apr 9 16:38:36 CEST 2013


On Tue, Apr 9, 2013 at 8:35 AM, daedae11 <daedae11 at 126.com> wrote:
> I refer the msdn for ShellExecute, there isn't a "runas" verb, only "edit",
> "find", "open", "print", "properties".

Adding a file to the all users startup folder probably doesn't even
require elevation. Maybe even a regular user can do it, given the
default ProgramData NTFS permissions. I don't remember what the
defaults are.

Background:

NT 6 (Vista) added User Account Control (UAC), which adds the "run as
administrator" option. This launches a process with an elevated access
token.

ShellExecute allows the same with the "runas" verb. You can verify
whether it exists on your system for the exefile filetype (e.g.
python.exe):

    C:\>reg query hkcr\exefile\shell\runas\command

    HKEY_CLASSES_ROOT\exefile\shell\runas\command
        (Default)    REG_SZ    "%1" %*
        IsolatedCommand    REG_SZ    "%1" %*

On a related note, the old "runas.exe" console command lets you launch
a process with the credentials of an administrator account. However,
it can't 'elevate' the process.


More information about the Tutor mailing list