Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
mazius123
- Posts: 6
- Joined: 23 Mar 2012 08:56
#1
Post
by mazius123 » 02 Apr 2012 13:35
even if the folder exist its create new one and moves the file ???
Code: Select all
@echo off
Title ImperialCraft 0.4.3 server by mazius123; %time%;
echo Startuojamas serveris ImperialCraft 0.4.3 (%~nx0 )
if exist {..\System_folder} (
goto Paleisti_bukkit
) else (
goto Sukurti_aplanka
)
:Sukurti_aplanka
if not exist Advanced_files mkdir Advanced_files
if not exist System_folder mkdir System_folder
move %~nx0 System_folder/
pause
Last edited by
mazius123 on 03 Apr 2012 04:02, edited 1 time in total.
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#2
Post
by abc0502 » 02 Apr 2012 14:11
Try this:
Code: Select all
@echo off
Title ImperialCraft 0.4.3 server by mazius123; %time%;
echo Startuojamas serveris ImperialCraft 0.4.3 (%~nx0 )
if exist {..\System_folder} (
goto Paleisti_bukkit
) else (
goto Sukurti_aplanka
)
:Sukurti_aplanka
if not exist Advanced_files ( mkdir Advanced_files
) Else ( goto next )
:next
if not exist System_folder ( mkdir System_folder
) Else ( goto next2 )
:next2
move %~nx0 System_folder/
pause
I added Else and :next and :next2
look at the code
-
aGerman
- Expert
- Posts: 4722
- Joined: 22 Jan 2010 18:01
- Location: Germany
#3
Post
by aGerman » 02 Apr 2012 14:27
mazius123 wrote:if exist {..\System_folder} (
What are the braces good for? This way it is looking for a folder
"{.." in the current directory with a sub folder or file
"System_folder}" in it.
If you would remove the braces (just
"..\System_folder") it would look for a folder or file
"System_folder" in the parent folder of the current directory.
How should your folder structure look like?
Regards
aGerman
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#4
Post
by abc0502 » 02 Apr 2012 14:35
I didn't notice the braces at all aGerman right there is no use of braces {
in "IF" command put the distination folder between "" like aGerman said