Use below code and write into the file, which is ended up with *.bat. Save the file double click on file. After which a form will popup in which you can enter username and password and password is not visible.
@echo off cls echo Please enter your user name and password in the entry box... If not exist %0 goto ERROR type %0 | find " " | find /v "Not Me!" > %TEMP%\UserIn.hta start /w %TEMP%\UserIn.hta call %TEMP%\UserIn.bat echo Your user name is %USERNAME% echo Your password is %PASSWORD% :: Clean up del %TEMP%\UserIn.hta del %TEMP%\UserIn.bat goto DONE :ERROR cls echo %0 is not the full path and file name echo for the batch file. You MUST call this echo batch file with a full path and file name. goto DONE :HTA :: All HTA code MUST be indented four or more spaces. <html> <head> <title>Password Entry</title> <hta:application> <script language="vbscript"> window.resizeTo 250,200 Sub SaveBatch() Set fs = CreateObject("Scripting.FileSystemObject") strFile = fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialFolder(2), "UserIn.bat")) Set ts = fs.OpenTextFile(strFile, 2, True) ts.WriteLine "SET USERNAME=" & document.Forms(0).elements("username").value ts.WriteLine "SET PASSWORD=" & document.Forms(0).elements("password").value ts.Close End Sub </script> </head> <body> <form> User Name: <br><input type=text name=username tabindex=1> <br>Password: <br><input type=password name=password> <br><input type=button language="vbscript" value="OK" onclick="SaveBatch : Window.Close"> </form> <script language=vbscript> document.Forms(0).elements("username").focus </script> </body> </html> :DONE
below screen is of popup window
with same batch code my Password Entry popup not open
ReplyDeletecan u please post / comment ur code
ReplyDeleteHello
ReplyDeleteHow should i modify this script so i have 3 elements: 1 username, second username, and a password (let say for first username). so i can get their value.
I have added this lines but in the %temp%\UserIn.hta i don't see them. How is this possible :
ts. WriteLine "SET USERNAME2=" & document.Forms(0).elements("username2").value
..................
User Name2:
br input type=text name=username2 tabindex=1
Please do these changes .. it is working fine for me.
ReplyDeleteecho Your user name is %USERNAME2% (at line 14)
ts.WriteLine "SET USERNAME2=" & document.Forms(0).elements("username2").value (at line 42)
and
mid Name:
input type=text name=username2 tabindex=2 (at line 52 , line no's according to after change in file)
keep in mind that " All HTA code MUST be indented four or more spaces."
basic
ReplyDelete