I am trying to find a batch file command that will allow me to run all .lnk or .html files with in a folder. I tried using the wildcards (*.lnk) but this wouldn't work. Any ideas?
2 Answers
Based upon further comments, this should help - you don't need recursion to process a single folder, and this will handle long filenames.
@echo off
for %%v in ("C:\Users\username\Desktop\Test\*.lnk") do start "" "%%~v"
It will open every .lnk file in the folder.
1 Comment
Claudia
This could be easily modified to a different path or to start a different extension.
You can use this:
for /r %%v in (*.lnk) do start %%v
Note:
Don't put spaces on shortcut filenames.
4 Comments
swstrau118
I tried to run this and it won't open the .lnk file Here is the code I am using. for /r %%v in (C:\Users\'username'\Desktop\Test*.lnk) do start %%v
vahnevileyes
(C:\Users\'username'\Desktop\Test*.lnk) What is Test in here? a folder or file?
swstrau118
It's a folder and it has the .lnk file in there. I am doing the Test'\'*.lnk - Not sure why It didn't copy over into the previous comment.
vahnevileyes
You must put a forward slash after the test (C:\Users\'username'\Desktop\Test*.lnk) Try this one: for %%v in (C:\Users\Username\Desktop\Test\*.lnk) do start %%v