Reputation: 137
I want to check if a folder is empty or has a file in it with a batch command.
I already have this code (which works): >nul 2>nul dir /a-d "folderName\*" && (echo Files exist) || (echo No file found)
Now I want to start an .exe if there are files in that folder. How can I do that?
Upvotes: 0
Views: 32
Reputation: 38579
One method using the Where command:
Where/Q C:\Users\Gunter\FolderName:*
If %ErrorLevel%==0 Start "" SomeFile.exe
Upvotes: 1