WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Password Tips

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Clipboard Trick to Hide Password from Users

Keywords:     hide passwords

Question:

Can you hide text from a user's view using the sendkey command? I have a batch that logs into a server and sends the password. Just wondering if we can send astericks instead of the actual characters. SendKey("password")/hide or something.

Answer:

  1. Generally the password dialog boxes are supposed to hide it for you.

  2. You could set up a "cover screen" (search database for "ignoreinput" and poke around. NB: The Function IgnoreInput only works in 16-bit Windows 3.1/3.11, and in Winbatch v2002B and later on Windows 98/ME/XP/2000, but not on 95 or NT4.)

  3. A WB user reported: I was faced with this same problem a while ago and used ClipPut to get around it as it is MUCH faster than SendKeys and allows (if the corresponding dialog box does) sending asterisks instead.

    The following code can be modified for your situation.

            userid="sa"
            password="mypassword"
            dummypass="nicetry"
            
            Run("%drive%\adm.exe","")
            
            While !WinExistChild("User Administration Login","Password:")
               TimeDelay(1)
               ; fill up clipboard with userid
               ClipPut(userid)
               TimeDelay(1)
               SendKeysTo("User Administration Login","^v{TAB}")
               ClipPut(password)
               TimeDelay(1)
               SendKeysTo("User Administration Login","^v{TAB}{SP}")
               ; fill up clipboard with dummypassword to prevent some smart user from using
               ; notepad to paste clipboard and discover password
               ClipPut(dummypass)
               Exit
            Endwhile
    

Article ID:   W13305
Filename:   Clipboard Trick to Hide Password from Users.txt
File Created: 2002:01:23:13:28:30
Last Updated: 2002:01:23:13:28:30