MCT 0 Posted February 11, 2005 im trying 2 make a simple script that i can run to simply change the password of my administrator account 1 problem i cant seem 2 figure out $passwd = InputBox("Please Choose Password", "Enter your password.", "", "") RunWait(@ComSpec & " /k " & 'net user Administrator $passwd') the password isnt set to whatever is in the input box , instead its set to $passwd any help would be appreciated, im wanting 2 as u probly assume set the password via an input box Share this post Link to post Share on other sites
ZeDMIN 0 Posted February 11, 2005 im trying 2 make a simple script that i can run to simply change the password of my administrator account1 problem i cant seem 2 figure out$passwd = InputBox("Please Choose Password", "Enter your password.", "", "") RunWait(@ComSpec & " /k " & 'net user Administrator $passwd')the password isnt set to whatever is in the input box , instead its set to $passwdany help would be appreciated, im wanting 2 as u probly assume set the password via an input box<{POST_SNAPBACK}>try$passwd = InputBox("Please Choose Password", "Enter your password.", "", "") RunWait(@ComSpec & " /k " & 'net user Administrator ' & $passwd) Share this post Link to post Share on other sites
MCT 0 Posted February 11, 2005 (edited) thx man it works i was trying for like 2 hrs lol EDIT: how can i make something like "if $passwd = blank" then do... else run the command Edited February 11, 2005 by MCT Share this post Link to post Share on other sites
MHz 80 Posted February 11, 2005 Your problem. You entered the variable within the string. You should keep them seperate. Share this post Link to post Share on other sites
MCT 0 Posted February 11, 2005 right.. but how can i add this to my command "if $passwd = blank (null)" then msgbox(0, "Error", "Cannot Use Blank Passwords" Elseif RunWait(@ComSpec & " /k " & 'net user Administrator ' & $passwd) Share this post Link to post Share on other sites
SlimShady 1 Posted February 11, 2005 $passwd = InputBox("Please Choose Password", "Enter your password.", "", "*") If $passwd = "" Then ;password is blank Else RunWait(@ComSpec & " /k " & 'net user Administrator ' & $passwd) EndIf Share this post Link to post Share on other sites
MCT 0 Posted February 11, 2005 ive been messing around with the new GUI stuff ive got a button "Add User" & the username is typed in a text box, so how do i make it when u click the "add user" button it sets whatever's in the input box ($usrname is the variable i use) expandcollapse popup#include <GUIConstants.au3> GUICreate("User Account Creator") ; will create a dialog box that when displayed is centered GUISetFont(9, 300) $tab=GUICtrlCreateTab (10,10, 300,200) $tab0=GUICtrlCreateTabitem ("Add User") GUICtrlSetState(-1,$GUI_SHOW) ; will be display first $tab0OK=GUICtrlCreateLabel ("Username", 20,50,80,50) $usrname=GUICtrlCreateInput ("Administrator", 90,50,90,20) $tab0OK=GUICtrlCreateLabel ("Password", 20,80,80,50) $passwd=GUICtrlCreateInput ("MCT", 90,80,90,20) $radio1 = GUICtrlCreateRadio ("Yes", 20, 150, 40, 20) GUICtrlSetState ($radio1,$GUI_CHECKED) $radio2 = GUICtrlCreateRadio ("No", 60, 150, 40, 20) $tab0input=GUICtrlCreateLabel ("User is Admin", 20,130,80,20) $tab0OK=GUICtrlCreateButton ("Add User", 170,150,80,20) GUICtrlCreateTabitem ("") ; end tabitem definition GUISetState () Do $msg = GUIGetMsg() if $msg = $passwd then;i know this section isnt correct If $passwd = "" Then RunWait(@ComSpec & " /k " & 'net user " & $usrname * /add"' ) RunWait(@ComSpec & " /k " & 'net accounts /maxpwage:unlimited' ) ;password is blank Else RunWait(@ComSpec & " /k " & 'net user " & $usrname $passwd /add"') RunWait(@ComSpec & " /k " & 'net accounts /maxpwage:unlimited' ) endif Until $msg = $GUI_EVENT_CLOSE Share this post Link to post Share on other sites