Is there any way to save null variables I have been saving and loading variables using.
(
echo %variable%
echo %variable2%
echo %variable3%
)>save.sav
and
(
set /p variable=
set /p variable2=
set /p variable3=
)<save.sav
This works fine, except that some variables are null (and I would like to keep them that way), and when
they have been saved and loaded, then they always show up as "ECHO is off." rather than just a blank.
What can I do to fix this? I want null variables to continue appearing as blank spaces even after loading.
Thanks in advance for your help.
Save/Load null variables
Moderator: DosItHelp
Re: Save/Load null variables
Code: Select all
@echo off
set "variable=var1"
set "variable2="
set "variable3=var3"
(
echo.%variable%
echo.%variable2%
echo.%variable3%
)>save.sav
(
set /p variable=
set /p variable2=
set /p variable3=
)<save.sav
echo.%variable%
echo.%variable2%
echo.%variable3%
Pause
Re: Save/Load null variables
I assume they are not defined. In that case you want to write an empty line into your file.some variables are null
Code: Select all
(
echo(%variable%
echo(%variable2%
echo(%variable3%
)>"save.sav"
Re: Save/Load null variables
NULL does exist as character but is used internally by cmd for delimiting variables in memory and cannot be assigned or it is used in the context of device during a redirection.some variables are null