2014-03-02 50 views
-1

如何使批處理Commando提示文件夾快捷方式?如何使批處理文件夾的快捷方式

我已經試過這樣:

複製 「C:\ WINDOWS」 「C:\用戶\%USERNAME%\桌面\ Windows.ink」

mklink 「C:\ WINDOWS」「C: \用戶\%USERNAME%\桌面」

+0

[創建快捷方式的可能重複從一個批處理文件](http://stackoverflow.com/questions/346107/creating-a-shortcut-for-a-exe-from-a-batch-file) - 創建一個文件夾是相同的爲可執行文件創建一個。 –

回答

0
@echo off 
    call :createDesktopShortcut "%~1" "%~2" 
    exit /b 

:createDesktopShortcut targetOfShortcut nameOfShortcut 
    if not exist "%~f1" goto :eof 
    setlocal & set "tempFile=%temp%\%~nx0.vbs.tmp" & set "name=%~2" & if not defined name set "name=%~n1" 
    echo(Set S=WScript.CreateObject("Wscript.Shell"):With S.Createshortcut(S.SpecialFolders("Desktop")+"\%~2.lnk"):.TargetPath="%~f1":.Save:End With>"%tempFile%" 
    cscript //nologo //e:vbscript "%tempFile%">nul & del /f /q "%tempFile%" >nul 2>nul 
    endlocal & goto :eof 

另存爲createDesktopShortcut.cmd並把它作爲

createDesktopShortcut.cmd "%windir%" "Win directory" 
相關問題