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

Posted on 2006-05-10
Last Modified: 2012-06-27
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...
Question by:Mattia Minervini
    LVL 7

    Expert Comment

    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>

    Author Comment

    by:Mattia Minervini
    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..


    Author Comment

    by:Mattia Minervini
    Another information....
    I need a prompt request for the user ...seems like "Please insert your name"!
    Thanks again
    LVL 14

    Expert Comment

    LVL 4

    Expert Comment

    SET /P PARAM=Enter parameter:
    LVL 10

    Accepted Solution

    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

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
    Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now