mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
$com #71208 12/02/04 04:29 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
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
Re: $com #71209 14/02/04 04:36 PM
Joined: Dec 2003
Posts: 219
F
fxmakers Offline
Fjord artisan
Offline
Fjord artisan
F
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.

Re: $com #71210 14/02/04 06:24 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
thanks:)


New username: hixxy
Re: $com #71211 15/02/04 03:06 PM
Joined: Feb 2004
Posts: 201
J
Jae Offline
Fjord artisan
Offline
Fjord artisan
J
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.
Re: $com #71212 15/02/04 04:01 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
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
Re: $com #71213 15/02/04 04:19 PM
Joined: Dec 2003
Posts: 219
F
fxmakers Offline
Fjord artisan
Offline
Fjord artisan
F
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".


Re: $com #71214 15/02/04 04:21 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
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 smile


New username: hixxy
Re: $com #71215 15/02/04 04:24 PM
Joined: Dec 2003
Posts: 219
F
fxmakers Offline
Fjord artisan
Offline
Fjord artisan
F
Joined: Dec 2003
Posts: 219
env variables seems not to be linked to the registry.

If you'd like to read/write/del a key to the registry, here are some threads:

http://forums.mirc.com/showflat.php?Cat=...o=&vc=1

http://forums.mirc.com/showflat.php?Cat=...o=&vc=1

http://forums.mirc.com/showflat.php?Cat=...o=&vc=1


Re: $com #71216 15/02/04 06:03 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
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.

Re: $com #71217 15/02/04 06:12 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
http://www.mircscripts.org/comments.php?id=963

mIRC-Env 1.0 by codemastr
DLL to set/read windows environment variables.

Re: $com #71218 15/02/04 06:30 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
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
Re: $com #71219 15/02/04 06:53 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Maybe this snippet will help.

Re: $com #71220 15/02/04 06:58 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
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
Re: $com #71221 15/02/04 07:15 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
See above
Quote:
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 smirk maybe somoene else does...

Re: $com #71222 22/02/04 06:50 PM
Joined: Feb 2004
Posts: 201
J
Jae Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2004
Posts: 201
Quote:
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 :-/

Re: $com #71223 23/02/04 07:33 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
WTH is "smd.exe"?

Re: $com #71224 23/02/04 08:39 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922

Re: $com #71225 23/02/04 09:14 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
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 smile

in cmd.exe/msdos.com you can type:
Code:
@echo on
echo %rand%

but you cannot retrieve %rand% the same way as %windir% or %comspec% anyone know why?


New username: hixxy
Re: $com #71226 23/02/04 09:37 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
If you say so... smile That just leaves a different question though.
WTH has cmd.exe got to do with opening comtrol panel applets?

Re: $com #71227 23/02/04 09:39 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
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. smile

Page 1 of 2 1 2