Batch File: Mask user input

Blekk

Posts: 53   +0
Hello,

I was just messing around last night while bored and realised that it takes me a few minutes to start up everything I want on the internet when I want it so thought I would create a batch file to do it for me. But I've hit a security problem:

I am going through my university's VPN connection to get onto the internet and therefore I need to enter a username and password, I have used rasdial for this and it works perfectly but I didn't want my password stored in the .bat because then anyone could steal it and use it.

Therefore I made the batch file ask for the password before executing the rasdial line, the only thing is, anyone shoulder-surfing me would be able to see my typing the password in as it comes up in the command prompt window when you type.

I was wondering if there was a way to mask user input for a batch file the same way that other user input is done, such as replacing whatever is typed with an asterisk such as:

"Enter Password: ********" rather than "Enter Password: mypassword" being displayed in the command prompt.

Thanks in advance,

Blekk
 
Rasdial

You can automate the connection process for any Microsoft client by using a simple batch file and the rasdial command. The rasdial command starts a network connection by using a specified entry.
Syntax

rasdial connectionname [username [password | *]] [/domain:domain] [/phone: phonenumber] [/callback:callbacknumber] [/phonebook: phonebookpath] [/prefixsuffix]

The rasdial command disconnects a network connection by using the following syntax:

rasdial [connectionname] /disconnect


username [ password | * ] : Specifies a user name and password with which to connect. If an asterisk is used, the user is prompted for the password, but does not display the characters typed.

From here: http://technet.microsoft.com/en-us/library/bb490979.aspx
 
Back