English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am trying to get the user to type in what they want to copy (in DOS), then copy it to the location they wish to copy, through a Batch File in DOS.

Please take a look at my code here:
http://www.triangleeventpros.com/DOS/bat.html

(Please only the latest version of DOS, NOT the old commands for older versions)


My main problem is:

I am having the most trouble around this part of the code... it's like it's not reading it right...
WHAT do I do.
I need it to validate if the File or Drive exists or not.
HELP.

Example)

IF not exist %1 echo File does not exist
goto END


IF not exist %2 echo Location does not exist
goto END

2006-06-28 09:54:43 · 4 answers · asked by Am 4 in Computers & Internet Programming & Design

What's "Python"?
Can it see what I'm doing wrong in my DOS code stuff?

2006-06-28 10:03:47 · update #1

I tryed changing the them to goto this is what happened...
http://www.triangleeventpros.com/DOS/bat2.html

2006-06-28 12:49:10 · update #2

The old dude “N2FC” was right (not tryin’ to diss your age)…
I mean at first it didn’t work
But then when I told it to GOTO instead of just “not exist” stuff
Then after I moved it around (the %2==%2) then it worked…

Check it out pplZ!

http://www.triangleeventpros.com/DOS/batworking.html

THANK U!!!!!!!!!!!!!!!!!!
(Too bad I already turned it in before I got it working LOL, but at least now I know what I was doin’ wrong Hehehehe)

2006-06-28 13:13:55 · update #3

4 answers

1) You should try making a flow-chart to see the issues here...

2) Your comparison: if %1==%1 (and also for %2) will ALWAYS BE TRUE and will never get to parts of your code!

2006-06-28 10:05:37 · answer #1 · answered by N2FC 6 · 2 0

The problem is that your script will always goto end and do nothing.

Batch is read line by line and executed line by line so using your example of;

IF not exist %1 echo File does not exist
goto END

your script looks for %1 and if not exist it echos out "File does not exist"

Then the very next thing you do is goto END.

Change it to;

IF not exist %1 goto err1
IF not exist %2 goto err2
goto ok
:err1
echo File does not exist
goto END
:err2
echo Location does not exist
goto END
:ok

and you should be good to go. If you have any problems let me know.

2006-06-28 11:52:24 · answer #2 · answered by boter_99 3 · 0 0

1. Open a notepad 2. Press Ctrl + O, 3. In the file of types combo box choose ALL FILES, then from the open dialog choose the batch file.

2016-03-26 20:56:28 · answer #3 · answered by Anonymous · 0 0

I can't help you with DOS batch files, but I can tell you you will have much better results (without having to post a zillion Yahoo questions) if you use Python.

Good luck!

2006-06-28 10:02:12 · answer #4 · answered by poorcocoboiboi 6 · 0 0

fedest.com, questions and answers