0

I need to write a batch script to run on windows.

I will schedule that file to run every minute on the server to test the existence of a txt file, on that server and then delete it.

Wha the batch file does is this:

check the existence of txt file on the server and if it finds that file in that location, 1) delete it 2 ) run some other actions.

I know what those actions are. I got the code for it already.

I need help only on how to check the existence of that txt file and how to delete it if it is there.

What commands do I need?

I'd appreciate if you could throw some pointers.

2

1 Answer 1

0

Rob Van Der Woude's batch file reference is an excellent source: http://www.robvanderwoude.com/if.php As it examples show how this can be achieved.

IF [NOT] EXIST filename command 

Something like this...

IF EXIST file.txt Start script.bat 

Or...

IF EXIST file.txt GOTO somelabel 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.