• (转载)如何创建一个以管理员权限运行exe 的快捷方式? How To Create a Shortcut That Lets a Standard User Run An Application as Administrator


    How To Create a Shortcut That Lets a Standard User Run An Application as Administrator

    Want to allow a standard user account to run an application as administrator without a UAC or password prompt? You can easily create a shortcut that uses the runas command with the /savecred switch, which saves the password.

    Note that using /savecred could be considered a security hole – a standard user will be able to use the runas /savecred command to run any command as administrator without entering a password. However, it’s still useful for situations where this doesn’t matter much – perhaps you want to allow a child’s standard user account to run a game as Administrator without asking you.

    We’ve also covered allowing a user to run an application as Administrator with no UAC prompts by creating a scheduled task.

     
     

    Enabling the Administrator Account

    First you’ll need to enable the built-in Administrator account, which is disabled by default.

    To do so, search for Command Prompt in the Start menu, right-click the Command Prompt shortcut, and select Run as administrator.

    Run the following command in the elevated Command Prompt window that appears:

    net user administrator /active:yes

    The Administrator user account is now enabled, although it has no password.

    To set a password, open the Control Panel, select User Accounts and Family Safety, and select User Accounts. Click the Manage another account link in the User Accounts window.

    Select the Administrator account, click Create a password, and create a password for the Administrator account.

     
     

    Creating the Shortcut

    Now we’ll create a new shortcut that launches the application with Administrator privileges.

    Right-click the desktop (or elsewhere), point to New, and select Shortcut.

    Enter a command based on the following one into the box that appears:

    runas /user:%computername%Administrator /savecred “C:PathToProgram.exe“

    Replace ComputerName with the name of your computer and C:PathToProgram.exe with the full path of the program you want to run. For example, if your computer’s name was Laptop and you wanted to run CCleaner, you’d enter the following path:

    runas /user:%computername%Administrator /savecred “C:Program FilesCCleanerCCleaner.exe”

    Enter a name for the shortcut.

    To select an icon for your new shortcut, right-click it and select Properties.

    Click the Change Icon button in the Properties window.

    Select an icon for your shortcut. For example, you can browser to CCleaner.exe and choose an icon associated with it. If you’re using an other program, browse to its .exe file and select your preferred icon.

    The first time you double-click your shortcut, you’ll be prompted to enter the Administrator account’s password, which you created earlier.

    This password will be saved – the next time you double-click the shortcut, the application will launch as Administrator without asking you for a password.


    As we mentioned above, the standard user account now has the ability to run any application as Administrator without entering a password (using the runas /savecred command to launch any .exe file), so bear that in mind.

    The Administrator password is saved in the Windows Credential Manager – if you want to remove the saved password, you can do it from there.

    转载自:https://www.howtogeek.com/124087/how-to-create-a-shortcut-that-lets-a-standard-user-run-an-application-as-administrator/

    附加: 

    RUNAS 使用方法:

    RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ] /user:<UserName> program

    RUNAS [ [/noprofile | /profile] [/env] [/savecred] ] /smartcard [/user:<UserName>] program

    RUNAS /trustlevel:<TrustLevel> program

    /noprofile 指定使用者的設定檔不該載入。這會導致應用程式載入速度更快,但可能引起一些應用程式運作失常。
    /profile 指定應該載入使用者的設定檔。這是預設值。
    /env 使用目前的環境,不用使用者設定的環境。
    /netonly 如果指定的認證是供遠端存取時才使用。

    /savecred 使用之前由使用者儲存的認證。
    /smartcard 當智慧卡提供了認證時使用。

    /user <UserName> 格式如下 USER@DOMAIN 或 DOMAINUSER
    /showtrustlevels 顯示可以用來作為 /trustlevel 引數的信任等級。
    /trustlevel <Level> 應該是以下 /showtrustlevels 列舉的其中之一等級。
    program EXE 的命令列。範例如下

    範例:
    > runas /noprofile /user:mymachineadministrator cmd
    > runas /profile /env /user:mydomainadmin "mmc %windir%system32dsa.msc"
    > runas /env /user:user@domain.microsoft.com "notepad "my file.txt""

    注意: 只有在提示時,才輸入使用者密碼。
    注意: /profile 與 /netonly 不相容。
    注意: /savecred 與 /smartcard 不相容。

    密码保存在了 : 控制台--->所有控制台項目--->認證管理員   

  • 相关阅读:
    C++实现网格水印之调试笔记(六)—— 提取完成
    C++实现网格水印之调试笔记(五)—— 提取出错
    C++实现网格水印之调试笔记(四)—— 完成嵌入
    Spark ---RDD
    Running Spark on YARN
    Spark官方2 ---------Spark 编程指南(1.5.0)
    Spark官方1 ---------Spark SQL和DataFrame指南(1.5.0)
    spark与hive的集成
    [mysql] ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).
    HDFS概述(6)————用户手册
  • 原文地址:https://www.cnblogs.com/ling3blog/p/9045104.html
Copyright © 2020-2023  润新知