Computing.Net > Forums > Programming > %windir% or %systemroot% ?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

%windir% or %systemroot% ?

Reply to Message Icon

Name: blackrat
Date: March 3, 2005 at 01:00:02 Pacific
OS: XP
CPU/Ram: Pentium 2800MHz/1GB DDR
Comment:

I'd like to program a batch scipt for all Windows OS.

Does anyone now, which OS understands which of this variables. On XP both are set to "Systemdriveletter:\Windows"

blackrat

Backup Incremental in WoW-Section
Batch to full, incremental or differential backup of folders, validation and achiving RAR



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: March 3, 2005 at 01:44:20 Pacific
Reply:

Hi,

I don't quite understand your second paragraph. But.

In my fairly regular w2k installation both are set to:

C:\WINNT

Dunno about DOS based windows vis-a-vis those variables. Somebody here will know.

You can make scripts which will pretty much work in either.

If a script relies on a 'command extension' which is available to it in NT, it will fail in DOS.

One example which comes to mind is that DOS does not have a built in %TIME% so if your script needs this you will need to set %TIME%

A handy way for your script to 'know' is:

if %OS%!==!
if %OS%!==Windows_NT!

On the general subject of TIME & DATE, keep in mind that the layouts of TIME & DATE will vary widely [and wildly] according to region & and user prefs. Not to mention non-English or two byte chars.


M2


0

Response Number 2
Name: blackrat
Date: March 3, 2005 at 03:23:13 Pacific
Reply:

Thanks, for date and time there is a prgraom called XSET, to solve this problem on 95/98/ME.

So is ther any difference between %windir% and %systemroot%?
Perhaps on 95/98/Me or NT?

blackrat

Backup Incremental in WoW-Section
Batch to full, incremental or differential backup of folders, validation and achiving RAR


0

Response Number 3
Name: Mechanix2Go
Date: March 3, 2005 at 03:38:25 Pacific
Reply:

Hi,

Still dunno about %windir%.

Yeah, there are plenty of 3rd party batch enhancers.

The challenge is to get stuff done using only the standard loadout of OS tools. Critical if you intend to distribute the BAT.


M2


0

Response Number 4
Name: MR Admin
Date: March 3, 2005 at 05:04:29 Pacific
Reply:

i would have thought that %windir% = c:\windows or c:\winnt for win 2K and win NT
and %systemroot% = c:\windows\system or c:\winnt\system for win 2K and win NT
but actually they mean the same thing
%windir% = c:\windows\ or c:\winnt
%systemroot% = c:\windows\ or c:\winnt
therefore %windir% = %systemroot%

not much help though was it but to answere you first question i dont know you could set a "if exist" if needed

MR Admin hear to help


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: %windir% or %systemroot% ?

Text or Binary file using C www.computing.net/answers/programming/text-or-binary-file-using-c/7512.html

interdev or macromedia www.computing.net/answers/programming/interdev-or-macromedia/4265.html

how to pass command to child shell? www.computing.net/answers/programming/how-to-pass-command-to-child-shell/13388.html