How to elevate Perl process using UAC

前端 未结 3 1061
野趣味
野趣味 2021-01-20 17:24

Suppose I have a script that needs to read information from places that normal user is not permitted to read (e.g. other users\' folders).

Currently all I can do is

3条回答
  •  轮回少年
    2021-01-20 17:41

    According to MSDN and PerlMonks, you can try:

    Win32::FileOp::ShellExecute( runas => 'yourprogram.exe' )
    

    or

    Win32::FileOp::ShellExecute( runasuser => 'yourprogram.exe' )
    

    These should (not tested) ask you for elevation when it is needed. (Works on Windows 7 only).

    Related: Requesting Administrator privileges during runtime

提交回复
热议问题