I have this batch file I wrote to open putty and want to make it a universal script for others. The script is as follows
@echo off
::Written by Mark Gulick::
::Today's Date 20150316::
set /p U="Enter Username: "
set /p P="Enter Password: "
set /p DC="Enter DC Number: "
start /d "C:\Program Files (x86)\putty\" PUTTY.EXE %U%@b0%DC%db -pw %P%
pause
I would like to make the password not show up and have tried some areas on here and haven't found one that will work. I might be doing it wrong too. I'm a little rusty on my scripting. Am I missing something or should I use something else other then the set command?
batch-file's cannot do this alone, but if you're running batch that means you're likely on windows, and automatically have VBScript installed. You can use this to get a password with masking:
randomThing.bat
password.vbs
Note I'm answering this on mobile, and as such cannot test if this method still works. However it gets the main idea across.
You can do something like this :
This post on DOSTips references a post here by MC ND, but I can't find the original, so here it is again. Whenever you want to get a password and mask the input, simply
call :getPassword target_variable input_prompt
wheretarget_variable
is the name of the variable you store the password in andinput_prompt
is whatever you show the user to prompt them to enter their password.