I need to create a Windows Batch File that can remember what user type for a short time.
I mean when I click my .BAT File, It should ask like Please enter your program installation directory
.
if user types nothing the batch file should exit otherwise it should set the text (The installation directory in my case)that user typed before to a variable like %DIRECTORY%
.
From there, the %DIRECTORY%
should behave like a variable and should has the ability to be mentioned like cd %DIRECTORY
, COPY %DIRECTORY/MyApp.exe
in next commands I use.
How can I do this?
I also tried to do this:
@echo off
color 1E
title TESTING BATCH FILE
echo Enter your APP INSTALLATION DIRECTORY.
echo.
echo.
set /p DIR=ENTER THE INSTALLATION DIRECTORY: <<<Prompting From The User>>>
echo DIRECTORY="%DIR%" <<<Set what user typed as a variable>>>
cd %DIR% <<<Execute further commands using it>>>
pause
exit
Thanks in Advance.