Microsoft
Software
Hardware
Network
Question : Batch file variable does not store value
I have a very simple batch file script that does not work as intended: a variable does not store its value.
@echo off
SETLOCAL
SET CURLDIR = fgggh
ECHO CURLDIR is %CURLDIR%
ENDLOCAL
The output is: "ECHO CURLDIR is"
The same is if I use "" like that: SET CURLDIR = "fgggh"
And sometimes the output is "ECHO is off" - not sure why.
But after I comment out the "@echo off" statement and execute the batch script, and then un-comment the "@echo off" again, it starts to display "ECHO CURLDIR is" again.
Commenting out SETLOCAL/ENDLOCAL does not change anything.
The script seems too simple, and still does not work properly.
What am I doing wrong?
Thanks!
Answer : Batch file variable does not store value
Try removing the spaces before and after quotes in the set statement.
1: 2: 3: 4: 5:
@echo off SETLOCAL SET CURLDIR=fgggh ECHO CURLDIR is %CURLDIR% ENDLOCAL
Random Solutions
Settings up vsftpd and ssl?
How can i sort two dimentional array with linq and with Compareto method?
MS Access SQL Divide by Zero workaround needed
How do I design network for failover to a secondary internet connection?
Microsoft VBScript runtime error '800a0009', Subscript out of range: '42'
sms gateway in asp.net
Use xcacls.vbs on \\server\share path
Script to enable folder auditing
When does a DBMS become necessary/very useful to use in conjunction with ArcGIS? (rather than doing everything with ArcGIS)
VLAN support for ASA 5505