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

Author Topic: Prompt for user input of file  (Read 3915 times)

0 Members and 1 Guest are viewing this topic.

TrampleLad

    Topic Starter


    Newbie

    Prompt for user input of file
    « on: February 04, 2009, 11:43:19 AM »
    I need to execute specific files based on a Change Request. The files names change with every change request. The directories where the files reside changes from time to time as well, depending on the version being deployed. There are usually many files residing in each version directory. Currently I copy the file to a separate "staging" directory, but I was wondering what I would need to add to my batch file to prompt the user to insert the directory name\file name in the command window so it can execute that specific file without having to copy the target file to a separate directory?

    gpl



      Apprentice
    • Thanked: 27
      Re: Prompt for user input of file
      « Reply #1 on: February 04, 2009, 12:07:21 PM »
      Try this
      Set /P MyDirectory=Enter Directory:

      This will wait for the user to enter a directory name, this will be held in %MyDirectory%

      Graham

      Dias de verano

      • Guest
      Re: Prompt for user input of file
      « Reply #2 on: February 04, 2009, 12:12:25 PM »
      You can use set /p to get user input into a variable

      Code: [Select]
      set /p path.and.name="Please type file path and name: "
      echo The user typed %path.and.name%

      Don't forget to use it as "%path.and.name%" for file operations if there is any possibility of it containing spaces.

      TrampleLad

        Topic Starter


        Newbie

        Re: Prompt for user input of file
        « Reply #3 on: February 04, 2009, 12:44:15 PM »
        That did the trick! Thank you both very much!