4

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 2

7

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.

Sign up to request clarification or add additional context in comments.

1 Comment

This could be easily modified to a different path or to start a different extension.
0

You can use this:

for /r %%v in (*.lnk) do start %%v

Note:

Don't put spaces on shortcut filenames.

4 Comments

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
(C:\Users\'username'\Desktop\Test*.lnk) What is Test in here? a folder or file?
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.
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.