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
DIfferent operating systems
Moderators: JRL, Dorian (MJT support)
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"
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"
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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!
Bob
A humble man and PROUD of it!