how to delete a cache or buffer variable

December 6, 2010 at 08:37:01
Specs: Windows XP
I worked to delete a cache variable by using @ECHO OFF, but the variable value remain the same after pressing the RETURN key. the variable or cache value is not flushed out.
BATCH PROGRAMMING

See More: how to delete a cache or buffer variable

Report •

#1
December 6, 2010 at 15:28:31
A bit more details would be helpful.
@ECHO OFF will not flush anything, it only suppresses echo output of every batch line to the screen.

The original poster should always write the last response !!!
Let us know, if the problem is solved !!!


Report •

#2
December 6, 2010 at 19:49:47
Well there are multiple batch files in a choice statements, when I call a value 2, it stores a '2' value in a buffer. After pressing return key, it always moves to 2 option. So I need to clear the cache after every option.

Report •

#3
December 6, 2010 at 21:00:49
choice stores the input in the system variable errorlevel.
You can check that with echo %errorlevel% and only stores the position of the valid input.
E.g.:
choise /c 1239
will give
input 1 - errorlevel 1
input 2 - errorlevel 2
input 3 - errorlevel 3
input 9 - errorlevel 4

Anyway, you can store this input in your own variable like:

@echo off
:start
set param=0
cls
echo Main Menu
echo.
echo 1 - Test 1
echo 2 - Test 2
echo 3 - Test 3
echo 9 - End Program
choice /c 1239
set param=%errorlevel%

if %param% 3 goto stop
if %param% 3 call batch3
if %param% 2 call batch2
if %param% 1 call batch1
goto start

:stop
echo Program stopped.

In this case, your own variable param will always be set to 0, when back in main batch file.

The original poster should always write the last response !!!
Let us know, if the problem is solved !!!


Report •

Related Solutions

#4
December 6, 2010 at 23:34:05
It is not working, it gets teminated while opening a batch

Report •

#5
December 6, 2010 at 23:35:09
@echo off
:start
set param=0
cls
echo Main Menu
echo.
echo 1 - Test 1
echo 2 - Test 2
echo 3 - Test 3
echo 9 - End Program
choice /c 1234

set param=%errorlevel%

if %param% 4 goto stop
if %param% 3 goto hi
if %param% 2 goto his
if %param% 1 goto her
goto start

:stop
echo Program stopped.


:hi
echo Hi
goto start

:his
echo hello
goto start

:her
echo bye
goto start


It's not able to start the batch file, automatically terminate out.


Report •

#6
December 6, 2010 at 23:39:34
thanks done, Thankyou man

Report •

#7
December 7, 2010 at 11:28:23
You are welcome.

The original poster should always write the last response !!!
Let us know, if the problem is solved !!!


Report •

Ask Question