Linked Questions

576 votes
3 answers
1.5m views

I need to run a utility only if a certain file exists. How do I do this in Windows batch?
sab's user avatar
  • 10.1k
3 votes
2 answers
16k views

Pseudo code: if file exists: do xxxx done else: do xxxx done
Bin Chen's user avatar
  • 63.6k
0 votes
1 answer
2k views

I need a batch code that will tell me if test.txt is there or not it is in the same directory as the batch file. I would like to know what I should put in the space where it says the code. Can anyone ...
09stephenb's user avatar
  • 9,914
0 votes
0 answers
105 views

I've had a script I've used for years...unfortunately, it isn't restartable. What I'd like to do is loop through and check to see if the files have been processed. If not, process them. The problem ...
user avatar
12 votes
3 answers
21k views

I have a script to delete all subfolders and files in a folder: FOR /D %%i IN ("D:\myfolder\*") DO RD /S /Q "%%i" & DEL /Q "D:\myfolder\*.*" And it works great! Only problem is that I would like ...
Thomas K's user avatar
  • 157
1 vote
1 answer
3k views

I have thousands of files in one folder and most of them have prefix in name like this: NNNN_*.jpg For example 3453_dfgdhfdgh.jpg, 1000_dfgdhfdgh.jpg, 5463_dfgdhfdgh.jpg etc. How can I with CMD ...
Klimashkin's user avatar
0 votes
1 answer
830 views

I am trying to create a script that will go through the MANY files and their locations, ensure the file exists, and if it does not exist, copy it from the location where it does. All of the files ...
freelancer's user avatar
-4 votes
1 answer
682 views

Batch script which would notify concurrently if any file or folder is created/ copied in a certain file location. The batch file will simulate a listener. When a new file/folder is copied/created in a ...
Mamun Rashid's user avatar
1 vote
3 answers
414 views

I am working on some batch script with following code block: echo off echo SETTING UP ANT FOR THE BUILD .... set ANT_HOME=%~dp0%build\apache-ant-1.8.2 set ANT_BIN=%~dp0%build\apache-ant-1.8.2\bin ...
Ashwin Hegde's user avatar
  • 1,771
0 votes
1 answer
622 views

In Batch, I know you can always specify a folder path in batch/cmd, for example, echo %RANDOM% >> C:\Users\User\Logs\log.txt or start C:\Windows\System32\cmd.exe But what if for example, your ...
Dorian Dore's user avatar
0 votes
1 answer
613 views

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 ...
Average Joe's user avatar
  • 4,641
0 votes
1 answer
261 views

I would like to run a batch script with the following syntax: @echo off for %%b in ("batchscript1.bat" "bat2" "bat3" "bat4" "etc" "etc") do ( call %%b || exit /b 1 ) How could I implement code ...
Georgep2000's user avatar
1 vote
1 answer
234 views

I have to: Copy a .doc file from a location to another Rename it at the new location (adding the current date to the name) Open the location where the copied/renamed file is now located Play a ...
Eta Beta's user avatar
  • 155
-2 votes
1 answer
218 views

Syntax for batch File for IF then ELSE How to create batch File which can check if file exists then exit out else create new file?
user3750473's user avatar