Hey guys,
I am trying to write a batch script that GETs the user input for location and a name of the file, STOREs/SAVEs it somewhere (in this case, in those 2 text files), and goes and grabs them for future use.
This is gonna be a part of my automation batch, that executes sql files automatically. And our sqls are designed and run on different environments(in this case it is DEV), but the first part of the name is always the same. Makes sense? That's why it would be more efficient if it asked for user input the first time running the files, and for the rest of them, just knows where to go and what to grab automatically.
This is what I have so far. But, it's not fully working.
@ECHO OFF
ECHO.
ECHO -+-+- Ready for DDL Deployment -+-+-
ECHO.
REM SET fileloc=%1
REM SET filenm=%2
SET /P fileloc=Enter the file directory^>
ECHO.%fileloc%> c:\ddlDeployment\automatic\filedir.txt
SET /P fileloc=< c:\ddlDeployment\automatic\filedir.txt
SET /P filenm=Enter the file name^>
ECHO.%filenm%> c:\ddlDeployment\automatic\filename.txt
SET /P filenm=< c:\ddlDeployment\automatic\filename.txt
REM ECHO Please enter the file directory followed by the file name:
ECHO .RUN FILE C:\DUR\DDL\%fileloc%\%filenm%_DEV.sql; >> runfile_dev.txt
pause
As you can see, i have 2 variables where a user will enter their input: fileloc (for the location part) and filenm(where the user enters that first part of the file name. Then those inputs are stored in filedir and filename .txt files.
Then, I want to RUN the file using those use Inputs (without asking for the user to input them again) and so on....
Any help would be appreciated!