Page 1 of 1

(SOLVED) .bat If Then statement

Posted: 31 Aug 2010 11:15
by jmituzas
I need help with writing a batch script for

if file newfile.txt exists
then del "InDesignData.txt" ren "newfile.txt" "InDesignData.txt"

Thanks in advance, Joe

Re: .bat If Then statement

Posted: 31 Aug 2010 11:33
by jmituzas
Solved

if not exist newfile.txt goto skip
del "InDesignData.txt"
ren "newfile.txt" "InDesignData.txt"
:skip

Re: (SOLVED) .bat If Then statement

Posted: 31 Aug 2010 16:09
by orange_batch
You could also,

Code: Select all

if exist newfile.txt (
del "InDesignData.txt"
ren "newfile.txt" "InDesignData.txt"
)


or,

Code: Select all

if exist newfile.txt del "InDesignData.txt"&&ren "newfile.txt" "InDesignData.txt"

Re: (SOLVED) .bat If Then statement

Posted: 01 Sep 2010 04:52
by miskox
Or

Code: Select all

if exist "newfile.txt" move /y "newfile.txt" "InDesignData.txt"



Saso