mIRC Home    About    Download    Register    News    Help

Print Thread
#26922 29/05/03 05:21 PM
Joined: Apr 2003
Posts: 413
A
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Apr 2003
Posts: 413
$Windir Identifier what will return the Windows directory ..
I know that can be do with a script(get dir from msdos.sys) .. Or check in all disk's if the win dir .. But it don't allways corect .. It must do with call the API function "GetWindowsDirectory" ..

#26923 29/05/03 05:26 PM
C
codemastr
codemastr
C
You can accomplish this either with a DLL or using COM.

#26924 29/05/03 05:27 PM
Joined: Dec 2002
Posts: 698
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 698
I would actually prefer $envar()
$envar(windir)
$envar(SystemRoot)
etc.

#26925 29/05/03 08:01 PM
L
Larra
Larra
L
mIRC, as all c/c++ coded apps, can easily retrieve the environment variables that system passes through arge ** (3rd param in main), so, I t would be a nice feature say...
$envvar(1), $envvar(2) returning the name, or $envvar(name) returning true or false
nice suggestion smile

#26926 30/05/03 02:15 AM
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
I'm not commenting on your suggestion (people tend to be rather sensitive/argumentative about the whole thing lately :tongue:), but here's how it can be done with the current version of mirc: The WshShell object (part of the Windows Scripting Host) provides a method for expanding environment variables. One of those variables is %WINDIR%, which expands to the actual Windows dir. Here's the alias:
Code:
[color:green]; usage: $com(variable). The %'s around the name are NOT required.[/color]
alias env {
  if * !iswm $1 { return }
  var %a = env $+ $ticks
  .comopen %a Wscript.Shell
  if $comerr { return }
  if $com(%a,ExpandEnvironmentStrings,3,bstr,% $+ $1%) && $com(%a).result != % $+ $1% {
    .comclose %a
    return $ifmatch
  }
  .comclose %a
}
To get the Windows dir, use $env(windir)

#26927 30/05/03 11:28 AM
Joined: Apr 2003
Posts: 413
A
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Apr 2003
Posts: 413
Thank you a lot qwerty smile You are great man smile


Link Copied to Clipboard