Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Batch File Question

  • 03-10-2009 3:06am
    #1
    Registered Users, Registered Users 2 Posts: 8,435 ✭✭✭


    How can I get a Batch file to prompt the user to enter the desired drive letter (For a backup location) ?

    -

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



Comments

  • Closed Accounts Posts: 6,151 ✭✭✭Thomas_S_Hunterson


    The "CHOICE" (think it was CHOICE.COM) command can prompt a user to enter a letter. It then stores the index of the letter (i.e. it's position in the list) in the ERRORLEVEL enviroment variable.

    I think it was removed in windows XP. I just checked my vista machine and it's on it but that could have been because I downloaded it, I'm not sure. You can download it and just distribute it with the batch file or stick it in your system32 folder.

    You'd then have to go through a ream of IF commands.

    I'm sure there's an easier way to do it, but it's been years since if used batch files.


  • Registered Users, Registered Users 2 Posts: 8,435 ✭✭✭Gadgetman496


    Thanks for the reply.

    I'm trying to avoid having to distribute anything else with the Batch file if possible.

    I'm sure too that it can be done from within the batch file but it's been years since I worked on them & I'm afraid the light bulbs are very dim :rolleyes:

    -

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



  • Registered Users, Registered Users 2 Posts: 386 ✭✭Zirconia
    Boycott Israeli Goods & Services


    You can use SET /P

    Look it up from the command prompt; SET /?

    for example:

    @echo off
    set /P DRIVE="Enter Drive Letter: "
    echo.
    echo You selected the %DRIVE% drive!
    echo.
    dir %DRIVE%:\
    pause


Advertisement