【问题标题】:Recursively create shortcuts in a folder(XP)在文件夹中递归创建快捷方式(XP)
【发布时间】:2011-04-29 05:15:06
【问题描述】:

1>

我在文件夹结构中有文件夹。

2> 我想递归地为每个文件创建快捷方式。

快捷方式必须放在相同的命名文件夹中,即位于其来源处。

3>

总结:相同的文件夹结构...只是代替文件的快捷方式

任何想法都会受到赞赏。

【问题讨论】:

    标签: windows scripting windows-scripting


    【解决方案1】:

    您需要递归方面的帮助,还是需要一些关于如何完成此任务的快速想法?我不打算写它,但你可以使用recursive batch file 初始命令如下所示:

    batchFile.bat "C:\OriginalLocation" "C:\CopyToLocation"
    

    我相信唯一的问题是您需要一个外部程序来创建快捷方式(快速谷歌搜索出现了一些)。您也许可以使用 VBScript 来做同样的事情,而无需外部快捷方式创建程序(再次,谷歌搜索提出了一些方法来做到这一点)。

    【讨论】:

      【解决方案2】:

      这里有一个 vbscript 你可以试试

      Set objFS = CreateObject( "Scripting.FileSystemObject" )
      Set oWS = WScript.CreateObject("WScript.Shell") 
      strFolder=WScript.Arguments(0)
      Set objFolder = objFS.GetFolder(strFolder)
      Go (objFolder)
      Sub Go(objDIR)
        If objDIR <> "\System Volume Information" Then
          For Each eFolder in objDIR.SubFolders
              Go eFolder
          Next
          For Each strFile In objDIR.Files
              shortcut = objFS.BuildPath(objFS.GetParentFolderName(strFile), objFS.GetBaseName(strFile)&".lnk")
              Set oLink = oWS.CreateShortcut(shortCut) 
              oLink.TargetPath = strFile.Path
              oLink.WorkingDirectory = objFS.GetParentFolderName(strFile)
              oLink.Save
              Set oLink=Nothing
          Next
        End If 
      End Sub 
      

      用法:

      C:\test> cscript //nologo mycreateshortcutscript.vb C:\test
      

      【讨论】:

        猜你喜欢
        • 2016-07-14
        • 2012-10-12
        • 1970-01-01
        • 1970-01-01
        • 2016-05-15
        • 1970-01-01
        • 1970-01-01
        • 2022-10-14
        • 2013-01-13
        相关资源
        最近更新 更多