• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2189
  • Last Modified:

How To User Input A variable to a batch file??

Hello people,
i need to write a batch file that launch the program prodname.exe.
The string that i need to launch has this shape  " prodname.exe -v -param"
how can i do a batch file where the user can insert in an interactive way the value of PARAM, and then press enter??!!!
Please help me!! Ask me for details, or something u didn't understand...
Thanks!
0
Mattia Minervini
Asked:
Mattia Minervini
1 Solution
 
MessHallManCommented:
If you batch file is opened in the following manor: c:\batchfile.bat <userinput>

The within the batch file the line would be prodnam.exe -v -%1

%1 is equal to whatever was entered in for <userinput>
0
 
Mattia MinerviniAuthor Commented:
Ok i tried in that way,but nothing to do....
I forgot to tell u that i need to launch my batch from a windows 98 floppy boot...
Maybe something change..
Thanks

0
 
Mattia MinerviniAuthor Commented:
Another information....
I need a prompt request for the user ...seems like "Please insert your name"!
Thanks again
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
cwwkieCommented:
0
 
CaudaxCommented:
@ECHO OFF
SETLOCAL
SET /P PARAM=Enter parameter:
PRODNAME.EXE -V -%PARAM%
0
 
For-SoftCommented:
The "SET /P" syntax will not work in Windows 98 DOS version.

The "COPY CON filename" is the only availeble solution in older DOS versions without additional software.

The simplest way to provide the user input system would be to display something like that:
Please insert your name preceeded with the letter A and a space character like this: A NAME

It will run the A.BAT file with %1 variable set by the user.

Or you can use the letter I, instead. (I AM JOHN). The I.BAT file would be started with %1=AM and %2=JOHN
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now