Adam Handley
asked on
Batch file to check if a folder exists with a certain word in
Hi,
Hopefully you can assist.
I would like to create a batch file to check if a folder exists. Each folder name is unique but has the same word 'Bomgar' within it. If the file exists then we will not run an executable. If it doesn't then it will run the executable.
I have tried the IF NOT EXIST command but not sure how to check for a word within a folder.
Thanks in advance.
Adam
Hopefully you can assist.
I would like to create a batch file to check if a folder exists. Each folder name is unique but has the same word 'Bomgar' within it. If the file exists then we will not run an executable. If it doesn't then it will run the executable.
I have tried the IF NOT EXIST command but not sure how to check for a word within a folder.
Thanks in advance.
Adam
ASKER
Thank you for your response and apologies for not being clear.
What i need to do is check in C:\ProgramData to see if a folder within there exists. The folder name will always have 'Bomgar' within it but then a unique identifier i.e 'Bomgar12345'. If this folder exists then we know the service has been installed and therefore doesn't need to be installed again. If that folder doesn't exist then we will want to run an executable to install.
Thanks again for your help.
Adam
What i need to do is check in C:\ProgramData to see if a folder within there exists. The folder name will always have 'Bomgar' within it but then a unique identifier i.e 'Bomgar12345'. If this folder exists then we know the service has been installed and therefore doesn't need to be installed again. If that folder doesn't exist then we will want to run an executable to install.
Thanks again for your help.
Adam
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect, thanks for the prompt response and solution.
For a given parent directory, you can do the following to check if it has a subdirectory with 'Bomgar' in it:
Open in new window
If you need something else, you need to elaborate a bit.