The problem is the spaces around the equal sign. This should do what you want.
set TESTVAR="No Value"
ECHO var = %TESTVAR%
set TESTVAR=""
ECHO var = %TESTVAR%
set TESTVAR="New value"
ECHO var = %TESTVAR%
More Related Contents:
- Windows Batch files: what is variable expansion, and what does EnableDelayedExpansion mean?
- How to get variable name?
- What’s the difference between placing “mut” before a variable name and after the “:”?
- Assign command output to variable in batch file
- When should an Excel VBA variable be killed or set to Nothing?
- set statements don’t appear to work in my batch file
- Why are variables “i” and “j” used for counters?
- How can I simulate an array variable in MySQL?
- Which variable size to use (db, dw, dd) with x86 assembly?
- When should I quote CMake variables?
- HiveQL: Using query results as variables
- Dynamically create variables in PowerShell
- In Rust, what’s the difference between “shadowing” and “mutability”?
- LessCss dynamic variables based on ancestor class
- Powershell pass variable to start-job
- How to make points one color when a third column equals zero, and another color otherwise, in Gnuplot?
- Determine variable names dynamically according to a string in Fortran
- Why there are two ways of declaring variables in Go, what’s the difference and which to use?
- In MATLAB, are variables REALLY double-precision by default?
- Comparing IEEE floats and doubles for equality
- Multiple variable assignment in Swift
- Why are variables “i” and “j” used for counters?
- Dynamic Variable Naming and Reference (ColdFusion)
- gnuplot store one number from data file into variable
- Set a path variable with spaces in the path in a Windows .cmd file or batch file
- What is “_,” (underscore comma) in a Go declaration?
- How to check if a parameter (or variable) is a number in a Batch script
- Why does Go allow compilation of unused function parameters?
- Create a variable in swift with dynamic name
- When should I quote CMake variable references?