A batch file like this could be used:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem Get version of Windows enclosed in square brackets from command VER.
for /F "tokens=2 delims=[]" %%I in ('ver') do set "VersionWindows=%%I"
rem Get major and minor version and build number from version information.
for /F "tokens=2-4 delims=. " %%A in ("%VersionWindows%") do (
set "VersionMajor=%%A"
set "VersionMinor=%%B"
set "VersionBuild=%%C"
)
if %VersionMajor% LSS 10 (
echo/
echo Your windows version cannot run gamehub!
echo/
echo [Press any key to cancel installer... ]
echo/
endlocal
pause >nul
exit
)
rem Other commands for installation like:
set "ProcessArchitecture=%PROCESSOR_ARCHITECTURE:~-2%"
if %ProcessArchitecture% == 86 (
set "ProcessArchitecture=32"
) else (
if exist %SystemRoot%\Sysnative\cmd.exe set "ProcessArchitecture=32"
)
echo Your are using Windows version %VersionMajor%.%VersionMinor%.%VersionBuild% %PROCESSOR_ARCHITECTURE%
echo The installation process is running in %ProcessArchitecture%-bit environment.
endlocal
Please take into account the Microsoft documentation pages:
It depends on the process starting the batch file if the batch file is executed by 32-bit cmd.exe
in %SystemRoot%\SysWOW64
or by 64-bit cmd.exe
in %SystemRoot%\System32
on Windows x64 (AMD64).
The following Wikipedia articles could be also helpful for this coding task:
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.
echo /?
endlocal /?
exit /?
for /?
if /?
pause /?
rem /?
set /?
setlocal /?
ver /?
And the name of the device NUL is nul
with just one L
. A line like pause>null
results in redirecting the message into file with name null
instead of device NUL. See also the Microsoft documentation pages Using Command Redirection Operators and Naming Files, Paths, and Namespaces containing among lots of other useful information also a list of device names.
And last but not least read also DosTips forum topic ECHO. FAILS to give text or blank line - Instead use ECHO/ and avoid in future echo.
in batch files and read about debugging a batch file.