I have a folder in %temp%\test\ with some files, now i need to run each files from cmd like:
for /r %%f in (%temp%\test\*) do (
start "'%~nxI'"
)
This code not working files are .exe, jpg and others...
I have a folder in %temp%\test\ with some files, now i need to run each files from cmd like:
for /r %%f in (%temp%\test\*) do (
start "'%~nxI'"
)
This code not working files are .exe, jpg and others...
As @jwdonahue pointed out, you didn't refer to your variable.
As written, you are referring to a variable I, which does not exist.
Also, if you are running from the command-line, you want to use a single %, not a double %%.
Try instead:
for /r %f in (%temp%\test\*) do (
start "'%~nxf'"
)
The portion: %~nxf means, "Refer to variable %f from the for-loop, but process it with ~n and ~x to get just the raw file name and extension.