1.

Solve : AMAZING!!! Batch File Challenge!?

Answer»

Hello!

Here's my issue, I need to have a batch file our users can download and it will PROMPT them for 2  items of info  'dbname' and 'dbpass'

With those 2 variables, it will fill in 3 lines of dos commands and save it to a specified directory as a batch file.

EXAMPLE USER INPUT:
-------------------------------
*launch .bat file*

DBNAME: testdb09   *user types dbname here*
DBPASS: testpass09 *user types dbpass here*

*then saves to specific *.bat file*
-------------------------------



THEN, EXAMPLE OUTPUT *.BAT:
-------------------------------
echo
C:\program\app.exe  -0 SQL: -DBNAME: testdb09  -DBPASS: testpass09  -commandone
C:\program\app.exe  -0 sql: -DBNAME: testdb09  -DBPASS: testpass09  -commandtwo
C:\program\app.exe  -0 sql: -DBNAME: testdb09  -DBPASS: testpass09  -commandthree
cls
exit
-------------------------------

Please guide me in any way possible!!!  Thank you in advance  sth like this ?

Code: [Select]echo off

set /p dbn=DBNAME:
set /p dbp=DBPASS:

C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandone
C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandtwo
C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandthreeHello,

Thank you for the RESPONSE

How can  I then have it export to a batch or text file  with the variables filled in?

What I mean is, when they type the DBNAME and DBPASS  it will save those credentials and then export that into a txt/batch file with the three commands filled in with there info.

Does that make sense? Code: [Select]echo off

set filename=tst.txt
set /p dbn=DBNAME:
set /p dbp=DBPASS:

echo.C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandone >%filename%
echo.C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandtwo >>%filename%
echo.C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandthree>>%filename%perfect!  perfect!

Now ...the last baby step.

It's gotta be a batch file,not a txt that file that it exports. which I can easily change the extension to *.bat.

But it's gotta export a file like this:

echo off
C:\program\app.exe  -0 sql: -DBNAME: exampledb  -DBPASS: examplepass  -commandone
C:\program\app.exe  -0 sql: -DBNAME: exampledb  -DBPASS: examplepass  -commandtwo
C:\program\app.exe  -0 sql: -DBNAME: exampledb  -DBPASS: examplepass -commandthree
cls
exit


Bro... I SERIOUSLY appreciate your help, I PROMISE I'm grateful  why not just remove the password if it's going to be in plaintext anyway...when this batch is all complete, we will then wrap the batch in an EXE.  I know that's not 100% secure, but it's a lot hard then reading the plain text of a batch file.



Discussion

No Comment Found