DIfferent operating systems

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
ADP_MAN
Junior Coder
Posts: 45
Joined: Wed Apr 07, 2004 2:04 pm

DIfferent operating systems

Post by ADP_MAN » Mon Jun 28, 2004 1:45 pm

How can you check to see what operating system you are running when you launch a script? I just recently changed to Windows XP and noticed that some of the commands are different (from Windows 2000 NT).

Ex:
From
Let>Notepad="C:\WINNT\system32\notepad.exe"

To
Let>Notepad="C:\Windows\notepad.exe"

Is there a way of having MS check the system first before issuing which command to use?

Thanks

Lumumba

Post by Lumumba » Mon Jun 28, 2004 3:28 pm

These are system variables which are accepeted from MacroScheduler

OS_VER Operating System

WIN_DIR Windows Directory Path

SYS_DIR Windows System Directory Path

TEMP_DIR Windows Temp Directory Path

---

Let>Notepad="%WIN_DIR%\notepad.exe"
or
If>OS_VER, WIN_NT, CMD
Let>COMSPEC=command.com
Goto>RunDirCheck

Label>CMD
Let>COMSPEC=cmd.exe

Label>RunDirCheck
RunProgram>%COMSPEC% dir "C:\*.txt; *.doc; *.csv"

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Jun 28, 2004 3:33 pm

Macro Scheduler has a built in variable OS_VER. You can look for this at the beginning of your script and branch according to results.
MidStr>%OS_VER%,1,2,OS
If>%OS%=95,WIN9X,NT

Label>WIN9X
Let>COMSPEC=Command.com
Let>Set other WIN 95/98 conditions
Goto>Start

Label>NT
Let>COMSPEC=Cmd.exe
Let>Set other WIN NT/2K/XP conditions
Goto>Start

Label>Start
...
...
Run Program>%COMSPEC% program.exe parameters
....
...
Label>End
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Guest

Post by Guest » Mon Jun 28, 2004 3:43 pm

When you get both Bob and Lumumba to answer you, you KNOW you have your problem solved.

Thanks!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts