Need Help!

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
manythanks2
Posts: 2
Joined: 21 Feb 2011 17:50

Need Help!

#1 Post by manythanks2 » 21 Feb 2011 17:56

I cant figure out what is wrong with this code. I don't need a new way to write, I just need proof reading, since I am just going from memory. Whenever I enter the answer for the prompt,"What drive is is in" or something of that nature, it closes down. Thanks in advance!


Code: Select all

@echo off
Title Folder/File Move
:Start
cls
echo ---------Folder/File Move---------
echo This is how it works
echo We move your files or folders
echo from the desktop to somewhere else.
echo But first, you must answer some questions
set /p File="Which file or folder would you like to move?"
set /p A="Which drive would you like it in? example C:,D:,E:     "
IF %1%="E" Goto disk
IF %1%="F" Goto FlashDrive
set /p S="What user?"
set /p D="What Folder?
set /p ?="Are there any more folders?"
If %?%=="Yes" Goto Extra
If %?%=="Yes" Goto Extra
If %?%=="No" Goto Move
If %?%=="no" Goto Move




:Extra
set /p F="What is the next folders name?"
set /p ?2="Any more?"
If %?2%=="No" Goto Movemore1

set /p G="What is the next folders name?"
set /p ?3="Any more?"
If %?3%=="No" Goto Movemore2

set /p H="What is the next folders name?"
set /p ?4="Any more?"
If %?4%=="No" Goto Movemore3
echo ERROR NO MORE FOLDERS CAN BE ADDED TO THE QUEUE
Goto Move

:Move
IF Exist C:\Users\Mike\Desktop\%file% move C:\Users\Mike\Desktop\%file% %A%:\Users\%S%\%D%
GOTO Success

:Movemore1
IF Exist C:\Users\Mike\Desktop\%file% move C:\Users\Mike\Desktop\%file% %A%:\Users\%S%\%D%\%F%
GOTO Success

:Movemore2
IF Exist C:\Users\Mike\Desktop\%file% move C:\Users\Mike\Desktop\%file% %A%:\Users\%S%\%D%\%F%\%G%
GOTO Success

:Movemore3
IF Exist C:\Users\Mike\Desktop\%file% move C:\Users\Mike\Desktop\%file% %A%:\Users\%S%\%D%\%F%\%G%\%H%
GOTO Success

:Disk
IF Exist C:\Users\Mike\Desktop\%file% move C:\Users\Mike\Desktop\%file% E:
Goto Success

:FlashDrive
If Exist C:\Users\Mike\Desktop\%file% move C:\Users\Mike\Desktop\%file% F:
Goto Success


:Success
Echo Success!!
pause > nul
Goto Start

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Need Help!

#2 Post by aGerman » 21 Feb 2011 18:34

IF %1%="E" Goto disk
IF %1%="F" Goto FlashDrive

Where does %1% come from? (I think it should be %A%)
= is not a compare-operator, it should be ==
Why do you enclose the drive letters in quotes but not the variable?

Code: Select all

IF "%A%"=="E" Goto disk
IF "%A%"=="F" Goto FlashDrive

There are a lot of failures in your code. Let's see what you could figure out by yourself :wink:

Regards
aGerman

manythanks2
Posts: 2
Joined: 21 Feb 2011 17:50

Re: Need Help!

#3 Post by manythanks2 » 21 Feb 2011 20:38

Oops, posted the wrong version. I caught the mistakes that you posted early on, but missed the equals sign. The %1% was from the middle of a variable change from numbers to letters. Thanks

Post Reply