tsolrm Posted April 26, 2012 Share Posted April 26, 2012 I want to add my script to start up and i'm trying to use registry to do this RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "TEST.exe", "REG_SZ", @WindowsDir&"\TEST.exe") However when I open that folder in registry using regedit, i'm not seeing any changes. What am I doing wrong? Link to comment Share on other sites More sharing options...
Skitty Posted April 26, 2012 Share Posted April 26, 2012 (edited) You're probably using vista or windows seven under a guest or non admin account or UAC is enabled. Try adding #RequireAdmin to the top of your script and report back here with results. Edited April 26, 2012 by ApudAngelorum Link to comment Share on other sites More sharing options...
tsolrm Posted April 26, 2012 Author Share Posted April 26, 2012 I've already included the requireadmin bit and yes i am using W7 Link to comment Share on other sites More sharing options...
Skitty Posted April 26, 2012 Share Posted April 26, 2012 (edited) I've already included the requireadmin bit and yes i am using W7So you're 100% sure that the script is running with administrator privileges and the write operation is not working still?This is an incredible anomaly.Maybe if you're using a x64 bit system and running the script using the x32 x64 bit interpreter, you might give this a try?RegWrite("HKLM64SOFTWAREMicrosoftWindowsCurrentVersionRun", "TEST.exe", "REG_SZ", @WindowsDir&"TEST.exe") Edited April 26, 2012 by ApudAngelorum Link to comment Share on other sites More sharing options...
tsolrm Posted April 26, 2012 Author Share Posted April 26, 2012 Right you've definitely showed me the right direction. I've removed "#AutoIt3Wrapper_UseX64=n" from my code and the changes have happened. However without this bit of code people running the x32 system will be unable to run the script. Anyway around this? Link to comment Share on other sites More sharing options...
Skitty Posted April 26, 2012 Share Posted April 26, 2012 (edited) There are ways to make the script work on both architectures, research a little, it's not too hard to do.Correction: It's not hard at all. Just make sure you use the right base key depending on the interpreter architecture and the machines architecture.Func _CheckBaseKey($HKType) Local $CHECK = False If (@OSArch <> "X86") And @AutoItX64 Then If Number(StringTrimLeft($HKType, StringLen($HKType) - 2)) <> 64 Then #cs Jon once said somewhere that if running a compiled autoit script with an x86 interpreter the x64 OS will manually correct the key destination unless running with the x64 interpreter the system will assume the destination is correct, so just in case, we will attempt a correction manually in this area just for the heck of it.. Also note: If no match is found, we will throw an error because this shouldn't be written anywhere else. #ce Local Const $KeyVal[4][2] = [ _ ["HKCU", "HKCU64"], _ ["HKLM", "HKLM64"], _ ["HKEY_LOCAL_MACHINE", "HKEY_LOCAL_MACHINE64"], _ ["HKEY_CURRENT_USER", "HKEY_CURRENT_USER64"] _ ] For $I = 0 To UBound($KeyVal, 1) - 1 If StringInStr($KeyVal[$I][0], $HKType, 2) Then $HKType = $KeyVal[$I][1] $CHECK = True ExitLoop EndIf Next If Not $CHECK Then Return SetError(1, 0, False) EndIf EndIf Return SetError(0, 0, $HKType) EndFunc ;==>_CheckBaseKey Edited April 26, 2012 by ApudAngelorum tsolrm 1 Link to comment Share on other sites More sharing options...
tsolrm Posted April 26, 2012 Author Share Posted April 26, 2012 Thanks! Link to comment Share on other sites More sharing options...
Chimaera Posted April 26, 2012 Share Posted April 26, 2012 Have a look here there is a UDF for this If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted April 26, 2012 Share Posted April 26, 2012 (edited) Cheers Chimaera, was about to suggest that too. Edited April 26, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now