locked
run as Different user script RRS feed

  • Question

  • hi all 

    I'm facing difficulty to create a CMD  script to run an application like notepad as different user and I want the password to be saved so I don't have to write it 

    for example, <g class="gr_ gr_788 gr-alert gr_gramm Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="788" id="788">username</g> is test and password is 123

    what i have been reached is (runas /user:test "C:\windows\Notepad.exe")

    but it will ask for the password everytime I run it

    kindly help me 

    • Moved by Bill_Stewart Wednesday, December 12, 2018 9:35 PM Unanswerable drive-by question
    Sunday, September 9, 2018 8:04 AM

All replies

  • Fix you post.  It is full of unreadable characters.

    Read the following for instructions on saving a password

    runas /?


    \_(ツ)_/

    Sunday, September 9, 2018 8:09 AM
  • hi all 

    I'm facing difficulty to create a CMD  script to run an application like notepad as different user and I want the password to be saved so I don't have to write it 

    for example, <g class="gr_ gr_788 gr-alert gr_gramm Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="788" id="788">username</g> is test and password is 123

    what i have been reached is (runas /user:test "C:\windows\Notepad.exe")

    but it will ask for the password everytime I run it

    kindly help me 

    Hi Hussain,

    In order to solve your problem you can use /savecred as shown in the example below:

    runas /user:[Domain Name]\[User Name] /savecred [Application Name]

    In your example that would be:

    runas /user\test /savecred notepad.exe

    The first time you will be prompted for a password. 

    Once you enter the password, the next time you execute the command will not ask for it.

    After that, you can create a .bat file and execute it at anytime without entering the password.

    Hope this helps you !

    Sunday, September 9, 2018 8:52 AM