|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
i know how to see if an environmental variable exists, e.g: %comspec%, and to see what it contains, but does anyone/can anyone point me to a tutorial on how to make/edit your own variables using COM
New username: hixxy
|
|
|
|
Joined: Dec 2003
Posts: 219
Fjord artisan
|
Fjord artisan
Joined: Dec 2003
Posts: 219 |
Maybe adding a key to the Registry:
HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Control/Session Manager/Environment
Same for ControlSet002 and CurrentControlSet, I don't know who is the default one.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
New username: hixxy
|
|
|
|
Joined: Feb 2004
Posts: 201
Fjord artisan
|
Fjord artisan
Joined: Feb 2004
Posts: 201 |
ControlSet002 ...i dont have that one... but i do got ControlSet003 ...does that make much diff?
PS: also.. how to add in the new key? do i write to a .reg file.. and then run it? if so how do ya output binary info..
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment] "windir"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\ 00,25,00,00,00
would set %windir% to %SystemRoot%
how to get the hex vailue for doing that is my question..
Last edited by Jae; 15/02/04 03:12 PM.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
a /regwrite alias i made can write to: HKLM\test but not where environment vars are stored.
New username: hixxy
|
|
|
|
Joined: Dec 2003
Posts: 219
Fjord artisan
|
Fjord artisan
Joined: Dec 2003
Posts: 219 |
mmmmm indeed... The only way to set an env variable is using under cmd.exe set variable=blabla
Typing under cmd.exe echo %variable% returns blabla Nothing found in the registry about "blabla".
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
so i could just make a /run alias to hide the window set a var and close when it's finished. ok ty
New username: hixxy
|
|
|
|
Joined: Dec 2003
Posts: 219
Fjord artisan
|
Fjord artisan
Joined: Dec 2003
Posts: 219 |
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
I think you should be using HKCU\Environment\
Either way, I doubt if it would become available until Windows reads the registry entry again, which is usually at Logon.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
i was hoping that i wouldn't have to use a dll, i use 3 already -_-
New username: hixxy
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Maybe this snippet will help.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
same result, his $regwrite and my /regwrite can't write to that key for some reason.
New username: hixxy
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
See above I think you should be using HKCU\Environment\ Either way, I doubt if it would become available until Windows reads the registry entry again, which is usually at Logon I just tested with //echo -a $regwrite(HKCU\Environment\Sheep,Baaa) and it worked fine (after logoff/logon or opening/closing "sysdm.cpl > Advanced > Environment Variables") I don't know of a way to force Windows to reread the registry hives maybe somoene else does...
|
|
|
|
Joined: Feb 2004
Posts: 201
Fjord artisan
|
Fjord artisan
Joined: Feb 2004
Posts: 201 |
opening/closing "sysdm.cpl well all that need to be done now is use smd.exe to do that to.. maybe mIRC should be programmed to directly manipulate cmd.exe better as its a good work around for almost n e thing :-/
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
even though this has nothing to do with my original question, i'll ask here considering the post title is $com in cmd.exe/msdos.com you can type: but you cannot retrieve %rand% the same way as %windir% or %comspec% anyone know why?
New username: hixxy
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
If you say so... That just leaves a different question though. WTH has cmd.exe got to do with opening comtrol panel applets?
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Where, when and how is %rand% being set? BTW You don't need "@echo on" as that is the default.
|
|
|
|
|