1
I'm trying to make a script that helps to go through a big library with lots of folders, names and numbers. The part numbers are divided in 4 parts XXX.XX.XX.XXXX. To help the searching the library folders are set like this: (example names) 100_Vegetal\01_Flower\01_Red\0001_Rose
My issue is the name of the folders, if the folder was only called "100" it would be easy to go through. Here is the code that I use to separate the part number and to try to open the folder.
set /p pnr="Please enter the PNR : "
echo %pnr%
echo %pnr:~0,3%
echo %pnr:~4,2%
echo %pnr:~7,2%
echo %pnr:~10,4%
explorer ".library\%pnr:~0,3%(*)"
I would like to open a folder that has the first 3 digits of the part number. Can you please help me with that issue. I tried with the star but it open the explorer...
Thank you.
1Use
for /f "tokens=1-4 delims=." %%A in ("%pnr%") do Echo %%A,%%B,%%C,%%D
to split the pnr into four for meta variables %%A..%%D – LotPings – 2018-10-26T12:36:05.553Explorer doesn't accept wild-cards in a passed directory name: you need something like
for /d %%d in (".library\%pnr:~0,3%*") do start /w explorer "%%d"
. – AFH – 2018-10-26T12:41:25.663