Re: Why Won't my Batch File run in Win 2K or XP?

Posted: 07-30-2003, 01:09 PM
"KC" wrote:
> My objective is to have a batch file that determines
> the computer's operating system...
See the Mount/\Command "GetOS", which is part of the FREE Advanced NT/2K/XP
Command Library (ntlib.cmd).

(http://TheSystemGuard.com/MtCmds/GetValue/GetOS.htm)

*******
Notes:

1. .Mount/\Commands are constructed using ONLY builtin
commands common to all four platforms (NT/2K/XP/K3).
2. .M/\C's are NOT case sensitive. Mixed case is used
for visual clarity only.
3. ntlib.cmd provides over 100 resources to assist with
writing and documenting cross-platform scripts.
You can obtain it (for FREE) at (http://ntlib.com).

*******

-tsg
__________________________________________________ __________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!


Re: Why Won't my Batch File run in Win 2K or XP?


Reply With Quote

Responses to "Re: Why Won't my Batch File run in Win 2K or XP?"

KC
Guest
Posts: n/a
 
Re: Why Won't my Batch File run in Win 2K or XP?
Posted: 07-31-2003, 04:41 AM
OK I amended my file - it reads as shown below. It works fine in Win 98.
Does not work in Win 2k or XP. Under those operating systems the script does
not perform the copy or deletes. Is this because I am not using the syntax
that Guard referred to in the previous post?


@echo off
set ver=Win95
ver | find /i "Windows 95" > nul
if not ErrorLevel 1 goto %ver%

set ver=Win98
ver | find /i "Windows 98" > nul
if not ErrorLevel 1 goto %ver%

set ver=Winxp
ver | find /i "Windows XP" > nul
if not ErrorLevel 1 goto %ver%

set ver=Win2000
ver | find /i "Windows 2000" > nul
if not ErrorLevel 1 goto %ver%

echo Unknown operating system!
pause
goto Exit

:Win95
copy c:\windows\desktop\olp.ico c:\windows\system
del c:\windows\desktop\olp_shortcut.exe
del c:\windows\desktop\olp.ico
goto Exit

:Win98
copy c:\windows\desktop\olp.ico c:\windows\system
del c:\windows\desktop\olp_shortcut.exe
del c:\windows\desktop\olp.ico
goto Exit

:Winxp
copy /Y "c:\documents and settings\all users\desktop\olp.ico" %SystemRoot%
del "c:\documents and settings\all users\desktop\olp_shortcut.exe"
del "c:\documents and settings\all users\desktop\olp.ico"

:Win2000
copy /Y "c:\documents and settings\all users\desktop\olp.ico" %SystemRoot%
del "c:\documents and settings\all users\desktop\olp_shortcut.exe"
del "c:\documents and settings\all users\desktop\olp.ico"

:Exit
cls




"guard" <^T^S^G^n^e^w^s^@TheSystemGuard.com> wrote in message
news:bg8g2r$lvinp$1@ID-170595.news.uni-berlin.de...
> "KC" wrote:
> > My objective is to have a batch file that determines
> > the computer's operating system...
>
> See the Mount/\Command "GetOS", which is part of the FREE Advanced
NT/2K/XP
> Command Library (ntlib.cmd).
>
> (http://TheSystemGuard.com/MtCmds/GetValue/GetOS.htm)
>
> *******
> Notes:
>
> 1. .Mount/\Commands are constructed using ONLY builtin
> commands common to all four platforms (NT/2K/XP/K3).
> 2. .M/\C's are NOT case sensitive. Mixed case is used
> for visual clarity only.
> 3. ntlib.cmd provides over 100 resources to assist with
> writing and documenting cross-platform scripts.
> You can obtain it (for FREE) at (http://ntlib.com).
>
> *******
>
> -tsg
> __________________________________________________ __________
> TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
> Free and "Almost Free" Knowledge for Windows System Admins!
>
>

Reply With Quote
guard
Guest
Posts: n/a
 
Re: Why Won't my Batch File run in Win 2K or XP?
Posted: 08-01-2003, 03:29 AM
"Pegasus (MVP)" wrote:
> "Mount" commercial product...
Clarification:

The Mount/\Command "GetOS" mentioned previously
in this thread is included in the FREE Advanced
NT/2K/XP/K3 Command Library. This product is
Copyrighted Freeware with NO RESTRICTIONS on
personal or commercial use.

For info, see (http://ntlib.com).

*******

-tsg
__________________________________________________ __________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!


Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch file under XP error Steve Bratsberg Windows XP Help & Support 0 10-23-2003 01:14 AM
xcopy in batch file Joskin Windows XP Basics 2 07-28-2003 05:43 PM
batch file Shenan T. Stanley Customize Windows XP 0 07-18-2003 10:04 PM
Batch file help Manda Luyong Windows XP Help & Support 0 07-02-2003 02:31 AM
dos batch file in xp pro Gene Windows XP Embedded 0 06-26-2003 07:42 AM