|
Answer» Hello, I'm not very experienced with DOS so this may seem kinda basic. I have a DOS program that takes command line input and I want to write a script to execute it. In unix (K-shell) I might write something like:
/bin/ksh program << + 2 inputfile.dat outputfile.dat 3 +
in a text file and make it an executable and run it. How would I do this in DOS and do I call the file a .bat file? I'm running Win ME w/ the MSDOS prompt. Let me know if I need to define the question better.If i understand you CORRECTLY all your wanting to do is pass parameters to a dos batch.....? if so DOS uses the "%" to reference external parameters. they are assigned sequencially 1 thru 9 and then you use the shift if you need more.
example
runaprg.bat a data.dat
this how you would write runaprg.bat
echo off if %1==a goto myproga if %1==b goto myprogb goto notvalid
:myproga myaexe %2 goto end
:myprogb mybexe %2 goto end
:notvalid echo ... %1 is not a valid entry
:end
i use a batch file to format a diskette on the a drive and i do not want a bunch of yes no questions
so i have a batch file called formata.bat
the batch file says
format a:/q/u
is this what you want to do? ???Just call the executable from the .bat file along with the parameter you wish to pass. The entry would be EXACTLY like you would enter from the command line, providing the DIRECTORY is in the path. OTHERWISE, you would use cd command to change to the proper directory.This is standard UNIX syntax called "at document" to invoke a series of commands sequentially after having started some program. I need the same functionality to connect to a database and then run specified commands. Beginning to think it's not possible in DOS. Thanks enormously in advance for any CLUES.
|