Adding Wildcards to variables
Posted: 23 May 2018 13:17
Hello there! This is my first post here, so please apologize if I do not act strictly on forum rules.
I hope you can help!
What I'm trying to achieve:
I am creating a script that allows users tu enter three different variables (number="job number"; customer="Customer Name" and job="job description", that would later create a user path within a specific folder (%number%_%customer%_%job%). That part is easy.
However, what i can not achieve is cross checking if a folder already exists, based solely on the jobnumber.
What the script should do is check if an entered jobnumer is already in use within the destination folder. If so, it should open the existing folder(s) in explorer. There might be more than one with the same number (e.g. our dummy jobs all start with "000000").
Here is the simplified part of the script that should check whether there are already folders starting with the same number:
______________________________________________________
@echo off
set /p number="job number: "
set "folderExist="
for %%a in ("U:\destination\work in progress\%number%*") do set "folderExist=1" & goto continue
:continue
IF DEFINED folderExist (
start "" "U:\destination\work in progress\\%number%*"
) ELSE (
.... do something else ....
)
______________________________________________________
The asterisk as a wildcard is not recognised.
I hope you understand what I am trying to achieve here and that someone can assist me. Any help yould be greatly appreciated.
Best regards,
Andreas
P.S. Please note, that the destination folder is on a mapped network drive. I'm not sure if that makes any difference.
I hope you can help!
What I'm trying to achieve:
I am creating a script that allows users tu enter three different variables (number="job number"; customer="Customer Name" and job="job description", that would later create a user path within a specific folder (%number%_%customer%_%job%). That part is easy.
However, what i can not achieve is cross checking if a folder already exists, based solely on the jobnumber.
What the script should do is check if an entered jobnumer is already in use within the destination folder. If so, it should open the existing folder(s) in explorer. There might be more than one with the same number (e.g. our dummy jobs all start with "000000").
Here is the simplified part of the script that should check whether there are already folders starting with the same number:
______________________________________________________
@echo off
set /p number="job number: "
set "folderExist="
for %%a in ("U:\destination\work in progress\%number%*") do set "folderExist=1" & goto continue
:continue
IF DEFINED folderExist (
start "" "U:\destination\work in progress\\%number%*"
) ELSE (
.... do something else ....
)
______________________________________________________
The asterisk as a wildcard is not recognised.
I hope you understand what I am trying to achieve here and that someone can assist me. Any help yould be greatly appreciated.
Best regards,
Andreas
P.S. Please note, that the destination folder is on a mapped network drive. I'm not sure if that makes any difference.