IFW Batch Script with Win 10
Posted: Sun Aug 16, 2015 3:12 pm
The latest upgrade to Win 10 causes IFW batch scripts to fail. A simple, but not necessarily elegant, fix is to extend the current script statements in the Profile.cmd file.
Currently the script contains:
@echo off & cls & setlocal enableextensions
ver | find "Version 5." >nul
set VerCheck1=%ErrorLevel%
ver | find "Version 6." >nul
set VerCheck2=%ErrorLevel%
set VerCheck=%VerCheck1%%VerCheck2%
if "%VerCheck%"=="11" (echo These scripts run only on Windows 2000 or later.) & (MsgBox "These scripts run only on Windows 2000 or later." "Image for Windows Scripts" 4 1) & (goto :EOF)
Add a check for (the absence!) of Win 10 by changing the same script to:
@echo off & cls & setlocal enableextensions
ver | find "Version 5." >nul
set VerCheck1=%ErrorLevel%
ver | find "Version 6." >nul
set VerCheck2=%ErrorLevel%
ver | find "Version 10." >nul
set VerCheck3=%ErrorLevel%
set VerCheck=%VerCheck1%%VerCheck2%%VerCheck3%
if "%VerCheck%"=="111" (echo These scripts run only on Windows 2000 or later.) & (MsgBox "These scripts run only on Windows 2000 or later." "Image for Windows Scripts" 4 1) & (goto :EOF)
Now if all three checks fail the message for Win 2000 or later still applies and the batch process will abort. However the important part is that the existing backup script approach will succeed if all your copies of the Profile.cmd are modified accordingly.
Currently the script contains:
@echo off & cls & setlocal enableextensions
ver | find "Version 5." >nul
set VerCheck1=%ErrorLevel%
ver | find "Version 6." >nul
set VerCheck2=%ErrorLevel%
set VerCheck=%VerCheck1%%VerCheck2%
if "%VerCheck%"=="11" (echo These scripts run only on Windows 2000 or later.) & (MsgBox "These scripts run only on Windows 2000 or later." "Image for Windows Scripts" 4 1) & (goto :EOF)
Add a check for (the absence!) of Win 10 by changing the same script to:
@echo off & cls & setlocal enableextensions
ver | find "Version 5." >nul
set VerCheck1=%ErrorLevel%
ver | find "Version 6." >nul
set VerCheck2=%ErrorLevel%
ver | find "Version 10." >nul
set VerCheck3=%ErrorLevel%
set VerCheck=%VerCheck1%%VerCheck2%%VerCheck3%
if "%VerCheck%"=="111" (echo These scripts run only on Windows 2000 or later.) & (MsgBox "These scripts run only on Windows 2000 or later." "Image for Windows Scripts" 4 1) & (goto :EOF)
Now if all three checks fail the message for Win 2000 or later still applies and the batch process will abort. However the important part is that the existing backup script approach will succeed if all your copies of the Profile.cmd are modified accordingly.