I am trying to run notepad.exe as user "blain". Therefore I would like to use the command runas /u:blain notepad.exe in command prompt, which works as expected and prompts for the user password. I would like to automate it, so, assuming blain's password is "pass", I type echo pass| runas /u:blain notepad.exe.
No matter what I replace pass with, the command always returns:
C:\Users\blain>echo pass| runas /u:blain notepad.exe
Enter the password for blain:
Attempting to start notepad.exe as user "BLAINE-WIN-10\blain" ...
RUNAS ERROR: Unable to run - notepad.exe
1326: The user name or password is incorrect.
An interesting thing to note is that the message appears instantly after pressing enter. If I manually enter the password wrong, it takes ~2 seconds to tell me it's wrong (giving the same error message).