Skip to content

Instantly share code, notes, and snippets.

@numbnet
Last active January 21, 2021 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numbnet/3e9a3a6d231f3f6f72e962d19b0de421 to your computer and use it in GitHub Desktop.
Save numbnet/3e9a3a6d231f3f6f72e962d19b0de421 to your computer and use it in GitHub Desktop.
Variable

Ярлык с переменной

%comspec% /c start %cd%<ФАЙЛ В ЭТОМ КАТАЛОГЕ>.exe

@echo off
color 0a
CHCP 65001
cls
set curr_OS=
REM
ver | find /i "5.0"
if %errorlevel% == 0 set curr_OS=Windows 2000
REM
ver | find /i "5.1"
if %errorlevel% == 0 set curr_OS=Windows XP
REM
ver | find /i "5.2.3"
if %errorlevel% == 0 set curr_OS=Windows Server 2003
REM
ver|find /i "6.0"
if %errorlevel% == 0 set curr_OS=Windows Vista
REM
ver | find /i "6.1">nul
if %errorlevel% == 0 set curr_OS=Windows 7
REM
ver | find /i "10.0">nul
if %errorlevel% == 0 set curr_OS=Windows 10
REM
if "%curr_OS%"=="" set curr_OS=Unknown
echo Текущая версия ОС - %curr_OS%
echo ==============================
pause
@echo off
ECHO '========== Arhitecture x64 or x86============='
REM ##================================================
ECHO '========== VARIANT 1 ============='
pause
if "%PROCESSOR_ARCHITECTURE%" == "x86" (
echo "Windows x86"
) else (
echo "Windows x64"
)
REM ##================================================
REM ВСПЛЫВАЮЩЗИМ ОКНОМ
ECHO '========== VARIANT 2 ============='
pause
set Arch=x64
if "%PROCESSOR_ARCHITECTURE%" == "x64" ( if not defined PROCESSOR_ARCHITEW6432 set Arch=x86 )
if %Arch% == "x86" (
msg * "Windows x86"
) else (
msg * "Windows x64"
)
REM ##================================================
ECHO '========== VARIANT 3 ============='
pause
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x32" > NUL && set OS=32BIT || set OS=64BIT
if %OS%==32BIT echo "Windows x32"
if %OS%==64BIT echo "Windows x64"
pause
exit
@echo off
REM ##================================================
REM Arhitecture x64 x86
if "%PROCESSOR_ARCHITECTURE%" == "x86" (
echo "Windows x86"
) else (
echo "Windows x64"
)
If([IntPtr]::Size -eq 4)
{
Write-Host "32 bit"
}
Else
{
Write-Host "64 bit"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment