Accepting user input in a DOS batch file
-
The subject sounds simple doesn't it? We'll see.... My task is to take a collection of bios, firmware, and driver files, compress them, wrap a license agreement around them and post them on the web for download. When the user runs the downloaded executable, I present them with the option to make individual floppy disks from the compressed file so they can pick and choose which files they want to extract. For example, they might just want to make a bios disk and forget about the drivers. Of course, there are some limitations: 1) I do not have a license to redistribute any DOS files, so I can't bundle choice.com in the package. 2) The software I distribute is not public domain, so I can't redistribute any files that are covered under the GNU license (which eliminates Free DOS). 3) The user is expected to run the executable file on a windows-based PC to make the floppy disks. 4) This has to be done without paying for any new software licenses, can't violate copyright law, and I can't put my software into the public domain as defined by the GNU license. 5) The user can't be expected to open and edit any of the batch files themselves. So far, I have all of this working with a series of batch files: 1.BAT creates the BIOS disk on drive A: 2.BAT creates the firmware disk on drive A: etc All the user has to do is type in the correct number and they get the disk they want. The problem is that some users don't have a floppy drive designated as "A:". They use external USB floppy drives that can be any drive letter. I -could- create 100+ little batch files that cover every drive letter from A to Z for every disk option, but the user menu would be too large and confusing. Given these limitations, how can I let the user designate the appropriate drive letter for the floppy disk or somehow figure out what drive letter is assigned to the floppy disk and then use that drive letter to extract the files appropriately?
-
Answer:
Easier than you think. Wherever the string "%1" appears in the batch file, it will be replaced with the first parameter to the batch file. So, say you had a batch file called "f.bat". You would tell the user to type F and then the drive letter, so, for example: F A: In your batch file, you would do something like: format %1 Then, when the batch file is run, it will execute the command "format a:" You can use the %1 in your batch file as many times as you want. Same with %2, %3, etc.
headless-ga at Google Answers Visit the source
Related Q & A:
- How to run an interactive batch file on windows from a service?Best solution by Stack Overflow
- How I can validate input on form before upload file?Best solution by stackoverflow.com
- What would prevent a DoS attack?Best solution by esecurityplanet.com
- How do you convert a windows movie maker file to a regular video file?Best solution by Yahoo! Answers
- How to make a batch file copy itself?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.