1

I have a .bat file taking input from the user. I wish this input to be invisible as the user types it for security. The input is the user's password so it's important it cannot be seen by people looking over their shoulder.

The script right now has:

@echo off

set /p password="Enter the password for the connection: "
D. Farrell
  • 13
  • 5
  • You might want to go with the decade old technology instead of the four decades old one and use PowerShell which handles this sensible out of the box. – Voo Jul 20 '18 at 14:42
  • Batch files can use `Runas` same as powershell can even if Powershell has `Get-Credential` – user4317867 Jul 20 '18 at 14:44

1 Answers1

0

If you are going to start a program as the user, please use Runas /user:Domain\Username cmd.exe Which will prompt for password and not display the characters typed then starts CMD.exe as the user. You can test this by using Whoami

More info here

user4317867
  • 2,397
  • 4
  • 31
  • 57