Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
                          ╔══════════════════════════╗
                          ║        My Folder         ║
                          ╠══════════════════════════╣
                          ║1. Create Folder          ║
                          ║2. Delete Folder          ║
                          ║3. Move Folder            ║
                          ║                          ║
                          ║                          ║
                          ║                          ║
                          ║                          ║
                          ╚══════════════════════════╝
Enter Menu Number: [1,2,3]?1
Folder Name:joje
A subdirectory or file joje already exists.
Successful!

why "Successful!" is echoed? since it will only prompt if it goes to :create folder command..pls HELP me :( ..btw my OS is win7
====================================================================================
:MyFolder
Choice /C 123 /M "Enter Menu Number:"
If errorlevel 1 Goto 1
If errorlevel 2 Goto 2
If errorlevel 3 Goto 3

:1
set /p folderName=Folder Name:
if not exist '%folderName%' goto :createFolder

:createFolder
md %folderName%
echo Successful!
pause > nul
goto myFolder
Posted
Comments
[no name] 4-Aug-12 9:25am    
if not exist '%folderName%' goto :createFolder else goto :MyFolder
EjojAnrodac 4-Aug-12 9:30am    
Hey Wes! I really appreciate your advice..but still :( ..same output! its still echoing "Successful!"

T_T

I don't see how it could not do that. If it doesn't goto :createFolder, it will fall through to :createFolder. Then it will echo 'successful'. There's no path for it not to do that.
 
Share this answer
 
CSS
:createFolder
set /p folderName=Folder Name:
if exist %folderName% goto :error else :yes

md %folderName% (I just have to take this command line out in the :Yes command, strange isn't it?)

:yes
echo The folder %folderName% created successfully!
pause > nul
goto :1
exit

:error
echo The folder %folderName% already exist!
Pause > nul
goto :1
exit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900