1.

Solve : batch file, to see if file/folder exist?

Answer»

hey all..

i'm trying to write a batch file to see if c:\folder exists.  If it doesn't create it.
Then,

See if myfile.ini exists... if it does not, create it, and put
TEXT TEXT
TEXT2 TEXT2
in the file,
then close
and exit

any ideas?I've written the code but what is this going to be used for?lol guilty until proven inocent

I have an excel file that automaticly SAVES FILES to a folder... but it ERRORS out when the folder doesn't exist... so this is like an "Install" program to MAKE sure... and the mytext.ini stores some of the text for the spread sheet Quote

lol guilty until proven inocent
Yep 

Try this:

Code: [Select]echo off
if exist "C:\file.ini" (
echo. File Exists
pause
exit
) else (
echo Random Text >>"C:\file.ini"
exit
)

You may have to adapt the code though.


Discussion

No Comment Found