To check for a 64-bit version of Windows in a command box, I use the following template:
test.bat:
@echo off
if defined ProgramFiles(x86) (
@echo yes
@echo Some 64-bit work
) else (
@echo no
@echo Some 32-bit work
)
ProgramFiles(x86)
is an environment variable automatically defined by cmd.exe (both 32-bit and 64-bit versions) on Windows 64-bit machines only.
Related Contents:
- How can you find and replace text in a file using the Windows command-line environment?
- Example of delayed expansion in batch file
- How to set commands output as a variable in a batch file
- Windows batch: echo without new line
- How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required?
- Symbol equivalent to NEQ, LSS, GTR, etc. in Windows batch files
- Iterate all files in a directory using a ‘for’ loop
- How do you get the string length in a batch file?
- How to wait all batch files to finish before exiting?
- Trouble with renaming folders and sub folders using Batch
- Using a custom Tee command for .bat file
- Batch script: how to check for admin rights
- Setting a system environment variable from a Windows batch file?
- How to run a PowerShell script from a batch file
- Hidden features of Windows batch files
- How to get list of arguments?
- windows batch SET inside IF not working
- How to verify if a file exists in a batch file?
- Create an empty file on the commandline in windows (like the linux touch command)
- How can I run a program from a batch file without leaving the console open after the program starts?
- How do I echo and send console output to a file in a bat script?
- How to split a string by spaces in a Windows batch file?
- IF… OR IF… in a windows batch file
- Windows batch script to read an .ini file
- How to run a PowerShell script within a Windows batch file
- Windows batch script to parse CSV file and output a text file
- How to run batch file from network share without “UNC path are not supported” message?
- Windows Batch File Looping Through Directories to Process Files?
- How to ftp with a batch file?
- Can I send some text to the STDIN of an active process under Windows?
- Batch file variables initialized in a for loop
- Using parameters in batch files at Windows command line
- Resolve absolute path from relative path and/or file name
- Convert a small PS script into a long line in a .BATch file
- How to create an infinite loop in Windows batch file?
- How to create batch file in Windows using “start” with a path and command with spaces
- How do I create a shortcut via command-line in Windows?
- cmd is somehow writing Chinese text as output
- Running another program in Windows bat file and not create child process
- Kill a Process by Looking up the Port being used by it from a .BAT
- While loop in batch
- File is older than 4 minutes in Batch file
- Why “The system cannot find the batch label specified” is thrown even if label exists?
- How to echo “2” (no quotes) to a file, from a batch script?
- Remove unwanted path name from %path% variable via batch
- How to expand a CMD shell variable twice (recursively)
- Split %date% in a batch file regardless of Regional Settings
- CALL command vs. START with /WAIT option
- Batch file encoding
- batch file Copy files with certain extensions from multiple directories into one directory