The WINDIR property may not exist, in fact - probably does not, on a remote server. I think this is an NSH property and, as NSH is not installed on the remote server, the WINDIR paramater may not work on that server. If it is a native Windows environment variable, then it would actually be used as:
'nexec -e echo %WINDIR%', a DOS/WIN batch script method.
what happens if you open NSH and type 'echo $WINDIR'? you should see c:\windows or c:\winnt echoed back assuming that one of those two is your actual windir. see the attached file for a working sample.
if you type the NSH command 'set' by itself at an NSH prompt, you'll see every environment variable that's presently set echoed back to you.
windir.nsh 50 bytes
I used a batch file instead, which works for me, atleast in the short term.
Did anyone come up with an easy way of determineing WINDIR via NSH directly? Perhaps something like a blquery for a registry entry which returns WINDIR val? (Unfort I don't know which Reg entry would contain such info...)
In the case I'm working I don't want to pass the per-server $WINDIR into the NSH script, rather I want to determine $WINDIR in the script itself.
Thanks for any advice.
- Jim Collins
If you are in nsh, this should work for a remote server:
REMOTE_WINDIR=`nexec $SERVER 'cmd.exe' '/c echo %WINDIR%' | tr -d '"' | tr -d '[:cntrl:]' `