at batch end, send user to drive

May 4, 2009 at 08:38:58
Specs: DOS
I'm needing some help in figuring out how the heck to send a user to a drive they select. right now, I've got this:

:G
echo Which drive would you like to be directed to? [A,C]
fc con nul /lb1 /n | date | find "1:" > en#er.bat
echo set drive=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
if "%drive%"=="a" goto a
if "%drive%"=="A" goto a
if "%drive%"=="c" goto c
if "%drive%"=="C" goto c
set drive=

:A
echo 
A:
exit

:C
echo 
C:
exit


but it seems to just go to the last drive on the last line specified in the batch file. Can anyone help?


See More: at batch end, send user to drive

Report •


#1
May 4, 2009 at 09:00:14
"fc con nul /lb1 /n | date | find "1:" > en#er.bat"

I have no idea what that's about.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
May 4, 2009 at 09:05:38
That's a way for the user to input their choice from a menu without using errorlevels. It's the easiest way I could find and it's working ok to this point.

found it here
http://www.ericphelps.com/batch/sam...

But what about ending the script and sending a user to a specific drive?


Report •

#3
May 4, 2009 at 09:47:45
OK, if you say so. But all I get is an empty [size 0] en#er.bat.

fc is to compare two FILES; neither con nor nul is a file. They are system defined devices. I'm not running DOS but it may help to say what version, so somebody else can try it.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions

#4
May 4, 2009 at 09:52:18
I'm using 6.22. This is the only way I've found it to work for all of my menus for a project I'm doing.

Do you know of a way to make a more efficient menu selection?

Also, what about directing the user to a specific drive at the end of the script?


Report •

#5
May 4, 2009 at 10:21:35
@echo off

choice /c:AC Which drive would you like to be directed to?
goto :%errorlevel%

:1
a:

:2
c:


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#6
May 4, 2009 at 10:29:42
Oh, I should've mentioned I'm not allowed to use errorlevels on this project. I made the mistake of using errorlevels without knowing that so now I'm stuck rushing to get my project done by the deadline. Suuuucks.

But yeah I figured out how to send the user to a specific directory upon exiting. I just called a seperate batch file from my main batch.

Now I'm just wondering... how does the backup command work? Are you not able to backup a directory to a subdirectory? i.e. - backup a: a:\backup

Also, do you know why I am getting an error when trying to sort the text in a file? I'm trying to sort the 50 states using

sort states
echo.
pause
goto home

but it gives me an error saying

SORT: Too many parameters

I don't understand why, help please maybe?


Report •

#7
May 4, 2009 at 11:28:59
No idea why you get the SORT error.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#8
May 4, 2009 at 19:48:58
It may be a little late, but for your menu:

By what you posted() it looks like you have ansi.sys loaded and available, checkout this under the title "Ask for a string, using COPY CON, assuming ANSI.SYS loaded:"

It works the same way that the script I posted in your other thread does, except it binds f6 and enter to the enter key, meaning you don't need to use ^Z and enter, only enter.


Report •


Ask Question