I would like to target a folder from batch which potentially will change it's name over time. Say we have Folder 10102018
next time the batch will be run the folder name would be Folder 20102018
.
From CMD I am able to navigate to C:\Fold*
which results in (C:\Folder 10102018)
Using the same from a batch file errors as The system cannot find the path specified.
The command is -> "..\..\Folder 1.1.10102018\Install.exe"
What I try to achieve is to enter that folder using its constant bit of its name "Folder*" and to disregard whatever follows it as it is not really relevant... but hard to work around.
As always appreciate any help or alternative ideas!
I believe this is what you are looking for (given there is only one matching folder):
for /D %%I in ("..\..\Folder 1.1.*") do "%%~I\Install.exe"
Wildcards can only be used in the last element of a path, and they cannot be used at all to run an application.
Open a command prompt window, type for
/?
and read the help text to learn what for [/D]
does.