Need help with finding folders

April 5, 2009 at 19:16:58
Specs: Windows XP
:Privet
cls
color f
echo.
echo Please Choose a Name For Your Privet Folders :-
echo -----------------------------------------------
echo.
ping localhost -n 1 >nul
set /p newf= Folders Name:
echo.

md "%newf%"

cls
color a
echo.
echo "%newf%" Folders Created Successfully...
ping localhost -n 4 >nul
goto End

:CONFIRM1

if not EXIST "%newf%" goto Privet
echo your folder is exist
pause
=============================
but it always can't find the folder ?

help please
sss


See More: Need help with finding folders

Report •


#1
April 6, 2009 at 03:24:34
This is a shot in the dark, but try:
if not EXIST "%newf:"=%" goto Privet


Report •

#2
April 6, 2009 at 06:32:25
Dear Razor2.3,

thanx for your fast reply and for your help,,
but i'm sorry to say that didn't work :(
any other ideas ???

here what i did to the batch , just to make it more easy to read.

this batch file sepous to ask the user to type a folder name (e.g. folder name : smile) then it will creat that folder. but when the user start the batch again it hould tell him that the folder (smile) is exist ....... but still that always the batch can not find the smile folder and it will ask for make a new folder name ???
you can copy and paste the code to try it yourself in the desktop (i puted the batch on my desktop and also craeted the folder (smile) on the desktop.

============================================

@echo off
cls
:CONFIRM1

if not EXIST "%newf%" goto Privet
echo your folder is exist
pause
goto end
:Privet
cls
color f
echo.
echo Please Choose a Name For Your Privet Folders :-
echo -----------------------------------------------
echo.
ping localhost -n 1 >nul
set /p newf= Folders Name:
echo.

md "%newf%"

cls
color a
echo.
echo "%newf%" Folders Created Successfully...
ping localhost -n 4 >nul
goto End

:end

=============================


Report •

#3
April 6, 2009 at 10:18:42
:: You can save youself and the helpers confusion and wasted time
:: by leaving out the unneeded stuf.
::
:: No need to declare END ; EOF is built in.
::
:: No point in GOingTO the very next line.

:: Rediced to it's essentials:

@echo off & setLocal EnableDelayedExpansion

set /p n=new folder?
if exist !n! echo !n! already exists && goto :eof
md !n!


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions

#4
April 6, 2009 at 11:55:30
Dear Mechanix2Go...

thanx a lot for your solution it helped me in away.. ;)
bytheway i allways find your solutions to others very helpfull
and i learned lots of things from you i allways look up for your trade mark ( If at first you don't succeed, you're about average. M2)
and when i see it i know i found the right solution :)

so thank you very much to answer me so quickly...

but now, your batch works fine ,, but when i make the changes on my batch like below , it doesn't work !!!

====================================
@echo off & setLocal EnableDelayedExpansion
cls
:CONFIRM1

if not EXIST !newf! goto private
echo your folder is exist
pause
goto :eof
:private
cls
color f
echo.
echo Please Choose a Name For Your private Folders :-
echo -----------------------------------------------
echo.
ping localhost -n 1 >nul
set /p newf= Folders Name:
echo.

md !newf!

cls
color a
echo.
echo "!newf!" Folders Created Successfully...
ping localhost -n 4 >nul

======================================
i whant the user to start the batch then at 1'st it will create the folder "whatever" and then the batch ends.
in 2'nd time the batch starts it will tell the user that your folder "whatever" is allready exist so no need to make another folder...

can you please tell me what to do next ?

abisirar


Report •

#5
April 6, 2009 at 12:37:44
Your 4th line tests for a var which is not set.

if not EXIST !newf! goto private


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#6
April 7, 2009 at 04:38:45
yes i know !!!!!!! ;)

is there a way to tell the batch that the var ( folder name 'whatever' ) is allready exist ??
what i mean is : when the user inputs the folder name it will write back to the batch that 'whatever' name is the var !newf! so now the batch will save the name as a fixed string not as a var ...
let's say the user will start the bat the first time it will tell him to choose a name (let's say he writes 'smile' as folder name)
then the bat will save it as [!newf!=smile] and ends,
and now the 2'nd time the batch starts it will look for the folder 'smile' and then tell him if it's exist or not !!!!

my bat is to make folder only for one time and evrey time the bat starts it will tell him the folder 'smile' is exist and opens it by
start %newf% or in my case start smile .....

if not EXIST smile goto private
echo your folder is exist & start smile
pause
goto :eof
:private
-
-
-
-
-
-
-
end
================================

dear m2, i know i'v been pain in the axx ;)
but can you help me with that ?
you allready helped me alot. thanx :)
any small tip will be more than fine,
thank u in advance....
abisirar


Report •

#7
April 7, 2009 at 04:45:25
maybe i'll have to make it fixed name for folder

or if anyone have another sulotion ..

abisirar


Report •


Ask Question