Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Batch File to Open ALL Links in Folder


26 Dec 2009   #1

Windows 7 Ultimate 64-bit
 
 
Batch File to Open ALL Links in Folder

I have a few LNK files in the same folder and would like to write a batch file that opens all of these links without explicitly having each link listed in the batch file. Is there a way to open all links in one folder? I would presume so, considering Windows has for the most part always had a Startup folder, but I'm not interested in using the Startup folder. I would like these items to open only if I access this batch file.

Is there a way to do this?

My System SpecsSystem Spec
.

26 Dec 2009   #2

Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
 
 

@joshskorn

Here is a VBScript that will do what you want. It has no error checking it will just run everything in the C:\Program Files\Links folder.



Code:
 
Set WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService. _
ExecQuery("Select * from CIM_DataFile where Path = '\\Program Files\\Links\\'")
For Each objFile in colFiles
WshShell.Run Chr(34) & objFile.Name & Chr(34) 
Next
My System SpecsSystem Spec
27 Dec 2009   #3

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by WindowsStar View Post
@joshskorn

Here is a VBScript that will do what you want. It has no error checking it will just run everything in the C:\Program Files\Links folder.

@WindowsStar

I'm not familiar with VBScript files. How do I save this as? Is it still a *.bat file or something else?
My System SpecsSystem Spec
.


27 Dec 2009   #4

 

.vbs
My System SpecsSystem Spec
27 Dec 2009   #5

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by ccatlett1984 View Post
.vbs
Thank you. I actually found out using Google and was just about to post here that the solution provided by WindowsStar worked.
My System SpecsSystem Spec
Reply

 Batch File to Open ALL Links in Folder




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 04:04 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33