{green}If not exist folders goto create folder and start bat

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
mazius123
Posts: 6
Joined: 23 Mar 2012 08:56

{green}If not exist folders goto create folder and start bat

#1 Post by mazius123 » 27 Mar 2012 11:46

Hey, i want to know how can i check if there is folders ../sameexample and sameexmaple and if not exist create one sameexmaple and move the batch file int that folder and run it ...? or exist and run start example.bat (only once )

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: {green}If not exist folders goto create folder and start

#2 Post by dbenham » 27 Mar 2012 14:37

Huh :?: :?

I cannot understand what you are trying to do. And what is with {green} in the title?


Dave Benham

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: {green}If not exist folders goto create folder and start

#3 Post by abc0502 » 27 Mar 2012 14:56

:) I don't understand too!
what do u mean with move the batch file. what batch file! and what is example.bat !
and dbenham
i think he mean the MR.Green Smiles when he wrote {green}
Huh :)

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

Re: {green}If not exist folders goto create folder and start

#4 Post by aGerman » 27 Mar 2012 15:18

All I understood is that he probably needs to know where the batch file is currently placed. This may help:

Code: Select all

@echo off &setlocal
echo Me: %~f0
echo My path: %~dp0
echo My name: %~nx0
for /f "delims=" %%i in ("%~dp0.") do echo My folder: %%~nxi
for /f "delims=" %%i in ("%~dp0..") do echo My parent folder: %%~nxi
pause

Regards
aGerman

Post Reply