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

%windir% or %systemroot% ?

Reply to Message Icon

Original Message
Name: blackrat
Date: March 3, 2005 at 01:00:02 Pacific
Subject: %windir% or %systemroot% ?
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


Report Offensive Message For Removal


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

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


Report Offensive Follow Up For Removal

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

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


Report Offensive Follow Up For Removal

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

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


Report Offensive Follow Up For Removal

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

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


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: %windir% or %systemroot% ?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge