Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Winblows Environment Variables
New Posts  All Forums:Forum Nav:

Winblows Environment Variables

post #1 of 5
Thread Starter 
Ok, I have bzip2 for Windows and I wanted to make my own WinRAR SFX installer. That's the easy part.

I want to have a batch file or script of some-sort to permanently modify the PATH variable to append %systemdrive%\\bzip2\\bin on the end of it.

Everything I've half-assed researched brought up doing it manually in the sysdm.cpl or using set PATH=%PATH%;%systemdrive%\\bzip2\\bin which only stays useful for the current cli session.

Any help would be greatly appreciated.
Old Fart
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X4 940 ASUS M4N72-E eVGA GTX 275 SC 1796MB vRAM 2x G.Skill 2GB DDR2 800 
Hard DriveOptical DriveOSMonitor
640GB Caviar Black, 1500GB SATA2 LG SATA DVD+/-RW Windows 7 Ultimate Acer 24" 1080p LCD 
KeyboardPowerCaseMouse
Logitech Illuminated 800W Antec 900-2 Logitech Performance MX 
Mouse Pad
None! 
  hide details  
Reply
Old Fart
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X4 940 ASUS M4N72-E eVGA GTX 275 SC 1796MB vRAM 2x G.Skill 2GB DDR2 800 
Hard DriveOptical DriveOSMonitor
640GB Caviar Black, 1500GB SATA2 LG SATA DVD+/-RW Windows 7 Ultimate Acer 24" 1080p LCD 
KeyboardPowerCaseMouse
Logitech Illuminated 800W Antec 900-2 Logitech Performance MX 
Mouse Pad
None! 
  hide details  
Reply
post #2 of 5
Hi,

I know you can do it within Windows using code but if you want to use a batch file then you can use the setx.exe utility. I think (from memory) it came with the resource kit but I am reasonably sure it can be downloaded (feel free to correct me here). Also, I think it can be done with kixtart, or a vbs script. If nobody else can answer it off the top of their head I am sure I can track something down in one of the other languages . . .

Take care

Rhys
My System
(13 items)
 
  
CPUMotherboardMonitorKeyboard
Athalon 64 3000+ Gigabyte GA-K8V Ultra-939 Diamond Digital DV175 MCK-280 space saver 
Mouse
MS Optical Wheel Mouse 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardMonitorKeyboard
Athalon 64 3000+ Gigabyte GA-K8V Ultra-939 Diamond Digital DV175 MCK-280 space saver 
Mouse
MS Optical Wheel Mouse 
  hide details  
Reply
post #3 of 5
Right click on "my computer", go to "properties", go to "advanced", go to "environment variables", and add the appropriate variable.

EDIT: oho, it has to be automated. ignore this post.
post #4 of 5
You need to change a registry key. The PATH is stored in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Con trol\\Session Manager\\Environment\\Path. If you want the change to take effect immediately without a reboot, then you need to send a WM_SETTINGCHANGED Windows API message to the system to tell it to reread the registry.

I found some Delphi code on the web that explains the process, I'm sure you can translate it into whatever language you are using.

http://bdn.borland.com/article/0,1410,28254,00.html
Vulcan's PC
(18 items)
 
  
CPUMotherboardGraphicsRAM
Core i5 3570K Gigabyte GA-Z77X-D3H Sapphire HD 7950 G.Skill Ripjaws X 
Hard DriveHard DriveHard DriveOptical Drive
OCZ Vertex 4 SSD Western Digital Velociraptor Western Digital Caviar LG Blu-Ray burner 
Optical DriveCoolingOSMonitor
Philips DVD-DL burner Cooler Master Hyper 212 Plus Windows 7 Ultimate x64 Gateway FHD2400 
KeyboardPowerCaseMouse
Logitech G15 ThermalTake Smart 750W Lian Li PC-6077 Logitech G5 
Audio
Sound Blaster Z 
  hide details  
Reply
Vulcan's PC
(18 items)
 
  
CPUMotherboardGraphicsRAM
Core i5 3570K Gigabyte GA-Z77X-D3H Sapphire HD 7950 G.Skill Ripjaws X 
Hard DriveHard DriveHard DriveOptical Drive
OCZ Vertex 4 SSD Western Digital Velociraptor Western Digital Caviar LG Blu-Ray burner 
Optical DriveCoolingOSMonitor
Philips DVD-DL burner Cooler Master Hyper 212 Plus Windows 7 Ultimate x64 Gateway FHD2400 
KeyboardPowerCaseMouse
Logitech G15 ThermalTake Smart 750W Lian Li PC-6077 Logitech G5 
Audio
Sound Blaster Z 
  hide details  
Reply
post #5 of 5
Thread Starter 
Wow. I was kinda lost by that, so I downloaded a trial of Wise for Windows Installer and made a MSI installer package.

Thanks for the info.
Old Fart
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X4 940 ASUS M4N72-E eVGA GTX 275 SC 1796MB vRAM 2x G.Skill 2GB DDR2 800 
Hard DriveOptical DriveOSMonitor
640GB Caviar Black, 1500GB SATA2 LG SATA DVD+/-RW Windows 7 Ultimate Acer 24" 1080p LCD 
KeyboardPowerCaseMouse
Logitech Illuminated 800W Antec 900-2 Logitech Performance MX 
Mouse Pad
None! 
  hide details  
Reply
Old Fart
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X4 940 ASUS M4N72-E eVGA GTX 275 SC 1796MB vRAM 2x G.Skill 2GB DDR2 800 
Hard DriveOptical DriveOSMonitor
640GB Caviar Black, 1500GB SATA2 LG SATA DVD+/-RW Windows 7 Ultimate Acer 24" 1080p LCD 
KeyboardPowerCaseMouse
Logitech Illuminated 800W Antec 900-2 Logitech Performance MX 
Mouse Pad
None! 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Winblows Environment Variables