Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Username password regread and dropin

Status
Not open for further replies.

MelvinM

MIS
Jun 18, 2003
20
US
The real command:

C:\myprogram\foo.exe -tnet -proxyproxy.txt -uusr.lem.upt:demo

"includes parameters and username password.

Dim objShell
Dim objWsh
Dim wshshell
Set objWsh = CreateObject("Wscript.Shell")
Set objShell = CreateObject ("WScript.Shell")


Const username = "HKEY_CURRENT_USER\myprogram\someregkey\username"
Const password = "HKEY_CURRENT_USER\myprogram\someregkey\password"

Set wshshell = WScript.CreateObject ("WScript.Shell")
results = WShShell.RegRead ("HKEY_CURRENT_USER\myprogram\someregkey\username")
WScript.Echo results
Set WshShell = WScript.CreateObject ("WScript.Shell")
results = WShShell.RegRead("HKEY_CURRENT_USER\myprogram\someregkey\password")
WScript.Echo results

cmdline = cmdline = """c:\program files\myprogram\foo.exe"" -rite -proxy.txt -" & username & ",.lem" ":" & password & "upt,"
WScript.echo cmdline
objWsh.run cmdline,1,False

I am trying to take the regread from the username password regkeys and drop them into the appropriate spot in the .vbs script - but falling short in dropping in the username/password correctly. I think I am on the right track, but could use a hand.

Thanks!
 
MelvinM,

[1] objWsh, objShell, wshshell are one and the same thing. You can createobject() once, and use the same all the time. No need to give every operation a new name and create again. That's is how thing works.

[2] You wrote:
>C:\myprogram\foo.exe -tnet -proxyproxy.txt -[COLOR=black yellow]uusr.lem.upt:demo[/color]
and then
>& username & ",.lem" ":" & password & "upt,"
I can't even have enough words to highlight the difference. (Why suddenly all those commas and colon and some password between lem and upt...)

[3] username and password are defined in your script as a string indicating the reg keys to read. They are not the result of the reading. Make different name for the result according to where you read.

Cannot even start to correct things in this mess!

regards - tsuji
 
A starting point:
Dim Sh, strUser, strPassword
Set sh = WScript.CreateObject("WScript.Shell")
strUser = Sh.RegRead("HKCU\myprogram\someregkey\username")
strPassword = Sh.RegRead("HKCU\myprogram\someregkey\password")
' C:\myprogram\foo.exe -tnet -proxyproxy.txt -uusr.lem.upt:demo
cmdline = "C:\myprogram\foo.exe -tnet -proxyproxy.txt -u" & strUser & ":" & strPassword

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Sorry - I didn't know it was that bad.. I am new to .vbs Thanks for the tips and all the help.

I will see if I can get this working for me today..

Thanks alot again
 
Thanks! I got it working via PHVs way and I cleaned up my code till it also worked.

Have a good weekend.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top