Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file for running a program with user inputs  (Read 4069 times)

0 Members and 1 Guest are viewing this topic.

aslamyahya

    Topic Starter


    Starter

    • Experience: Familiar
    • OS: Windows 7
    Batch file for running a program with user inputs
    « on: April 01, 2014, 11:37:45 PM »
    Dear all,

    Im pretty new to batch scripting.
    So i wanted to execute a program with user inputs. Below is a typical

    Program to be run:

    c:/windows/programs/blabla.exe [starttime] [endtime] [filename]

    Can anyone help me with this.

    Cheers

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Batch file for running a program with user inputs
    « Reply #1 on: April 02, 2014, 12:28:01 AM »
    Can you explain further?

    aslamyahya

      Topic Starter


      Starter

      • Experience: Familiar
      • OS: Windows 7
      Re: Batch file for running a program with user inputs
      « Reply #2 on: April 02, 2014, 12:53:15 AM »
      'starttime' 'endtime' and 'filename' will be entered by the user who is running the script.

      So the program should ask the user for starttime, endtime and the filename and it runs the command line in the above mentioned format.

      Hope i helped in clarifying my query.

      Cheers

      aslamyahya

        Topic Starter


        Starter

        • Experience: Familiar
        • OS: Windows 7
        Re: Batch file for running a program with user inputs
        « Reply #3 on: April 02, 2014, 12:56:08 AM »
        starttime and endtime will be in the format ddmmhhmmss. i think the script can just treat it as a text.

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: Batch file for running a program with user inputs
        « Reply #4 on: April 02, 2014, 02:50:42 AM »
        This may work for you:

        Code: [Select]
        @echo off
        for %%a in (1 2 3) do set "var%%a="
        set /p "var1=Enter Start time: "
        set /p "var2=Enter   End time: "
        set /p "var3=Enter   FIlename: "
        "c:\windows\programs\blabla.exe" %var1% %var2% "%var3%"

        aslamyahya

          Topic Starter


          Starter

          • Experience: Familiar
          • OS: Windows 7
          Re: Batch file for running a program with user inputs
          « Reply #5 on: April 02, 2014, 03:08:40 AM »
          Thanks mate!