Batch File to Open ALL Links in Folder


  1. Posts : 121
    Windows 7 Ultimate 64-bit
       #1

    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 Computer


  2. Posts : 2,737
    Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
       #2

    @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
    Last edited by Brink; 26 Dec 2009 at 22:23. Reason: added code box
      My Computer


  3. Posts : 121
    Windows 7 Ultimate 64-bit
    Thread Starter
       #3

    WindowsStar said:
    @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 Computer


  4. Posts : 795
    windows 7 RTM x64
       #4

    .vbs
      My Computer


  5. Posts : 121
    Windows 7 Ultimate 64-bit
    Thread Starter
       #5

    ccatlett1984 said:
    .vbs
    Thank you. I actually found out using Google and was just about to post here that the solution provided by WindowsStar worked.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About 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 08:58.
Find Us