Nakatomi2010 Posted November 22, 2005 Posted November 22, 2005 (edited) WRONG FORUM!Please move this to proper forum, and I apologize... I'm tired....Alright, so if you type 'set CDROM=D:\' then everytime you type %CDROM%\command it'll look at the D:\ drive for that command... for that session only, once you reboot that is lost...My question is how do you set it to be permanent? For example, if you open up system properties and click aadvanced>Environment Variables and then click new, then type CDROM in the top box, and D:\ in the bottom box, now %CDROM%\command it's bound to that drive letter permanently....So, my question is how do you set it to be permanent?And then how could you have it look through all the drives looking for a file on the drive, THEN have it set that drive as a certain variable...?Why? Because I want to run WPI from the CD, not the hard drive... And setting the CDROM variable permanently would allow some future flexibility.... Edited November 22, 2005 by Nakatomi2010
Nakatomi2010 Posted November 22, 2005 Author Posted November 22, 2005 Alright....Through a rather clever exercise I've discovered that the environment variables are set at the following registry location:HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\EnvironmentNow.... From what I can tell typing in the following at the command prompt should add 'CDROM' as the variable...REG ADD HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment /v CDROM /t REG_EXPAND_SZ /d D:\The above line should make the change, but I keep getting 'Error: Too many command-line parameters'....What's wrong?
Nakatomi2010 Posted November 22, 2005 Author Posted November 22, 2005 Alright....I decided to just go around that limitation....I exported HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment to 'env.reg'Then, I opened up the file and saw a bunch of stuff... So I figured, alright, well that stuff's there by default... So I removed everything except for....Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment]"Garfunkle"="D:\\"Why Garfunkle? Because if you're looking for what setting gets changed as a result of a modification you'd better hope you don't have more than one entry, and I figured if I did a search using Regedit for 'Garfunkle', I'd have a higher chance of finding the right 'Garfunkle' than 'CDROM'So, now that the above code is all that's contained in the env.reg file I opened up the command prompt and typed in 'REG Import C:\env.reg' and blammo, %garfunkle% is now D:\...Now... There are limitations to this, which I need assistance with...First, it makes %Garfunkle% be 'D:\', the result is that if a machine has more than one hard drive, suddenly that's useless...SO, I need a way to have the thing search for a file, for example 'wpi.ico', which is the WPI icon, once it finds wpi.ico it edits D:\ in the env.reg file to say E:\. which is the CDROM drive, and then imports that, thus making the change permanent.....Or, if someone knows of an easier way....
ColdFusion200 Posted November 22, 2005 Posted November 22, 2005 if you know how to use vbs you could knock up a quick script to loop through all drives and see if the file exists. once you've found a drive that it exists on register the env variable
IcemanND Posted November 22, 2005 Posted November 22, 2005 use SETX or http://www.msfn.org/board/index.php?showtopic=38913&view=
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