kodius Posted April 7, 2009 Posted April 7, 2009 What is the easiest way to set the system path here: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] Value name: PATH Type:REG_EXPAND_SZ New Value Data:c:\program files\mytoolbox I want to append a new value, I found pathman.exe but was wondering if the forum had a clean way to do this without including external utilites.
KaFu Posted April 7, 2009 Posted April 7, 2009 For internal use try EnvSet(), but "Once AutoIt closes, the variables will cease to exist." OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Richard Robertson Posted April 7, 2009 Posted April 7, 2009 AutoIt has registry functions. What's wrong with using them?
Valuater Posted April 7, 2009 Posted April 7, 2009 Not sure exactly... but, maybe FileChangeDir(@ScriptDir) Changes the current working directory. 8)
Richard Robertson Posted April 7, 2009 Posted April 7, 2009 No, Val, the OP is trying to change the Path environment variable.
CodyBarrett Posted April 7, 2009 Posted April 7, 2009 why would you want that... there is a reason that it is the way it is [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Richard Robertson Posted April 7, 2009 Posted April 7, 2009 Are you kidding? There are a lot of reasons to change the path variable.
kodius Posted April 13, 2009 Author Posted April 13, 2009 I found some of this code in another topic but it doesn't work on the 3rd to last line ; Append to PATH Func _ToolKit() $sSep = ";" $sType = "REG_SZ" $path = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "PATH") If @extended = 7 Then $sSep = @LF $sType = "REG_MULTI_SZ" EndIf $path1 = $sSep & "c:\program files\mytools" $path2 = $path & $path1 RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", $path2) If @error <> 0 Then RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "PATH", $sType, $path2) EndFunc ;==>_ToolKit
PsaltyDS Posted April 13, 2009 Posted April 13, 2009 I found some of this code in another topic but it doesn't work on the 3rd to last lineDupe. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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