Resources for IT Professionals > 포럼 홈 > Windows PowerShell > How to create shortcut in startup menu using powershell?
질문하기질문하기
 

답변됨How to create shortcut in startup menu using powershell?

  • 2009년 6월 29일 월요일 오후 6:53Leonjl 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hi,

    Can anybody tell me how to create shortcut in startup menu using powershell?

    I found some samples about how to do this using VBS but I prefer powershell. :)

    Thanks
    Leon

답변

  • 2009년 6월 29일 월요일 오후 9:04Vadims PodansMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨코드 있음
    $objShell = New-Object -ComObject ("WScript.Shell")
    $objShortCut = $objShell.CreateShortcut($env:USERPROFILE + "Start Menu\Programs\Startup" + "\program.lnk")
    $objShortCut.TargetPath("path to program")
    $objShortCut.Save()
    this will create link from scratch.
    [тут могла быть ваша реклама] http://www.sysadmins.lv

모든 응답

  • 2009년 6월 29일 월요일 오후 7:18Marco ShawMVP, 중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I think these are typically .lnk files.  I don't think PowerShell can easily create these...  Unless you have an existing .lnk file, and you simply want to copy it to a new folder, you may need to refer to the VBS code.

    It possibly uses WScript, and you may want to use an interface to WScript for this...

    So the important question is...  Do you already have an .lnk file, and just need to copy it? Or do you need something from scratch?
  • 2009년 6월 29일 월요일 오후 9:04Vadims PodansMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨코드 있음
    $objShell = New-Object -ComObject ("WScript.Shell")
    $objShortCut = $objShell.CreateShortcut($env:USERPROFILE + "Start Menu\Programs\Startup" + "\program.lnk")
    $objShortCut.TargetPath("path to program")
    $objShortCut.Save()
    this will create link from scratch.
    [тут могла быть ваша реклама] http://www.sysadmins.lv
  • 2009년 6월 30일 화요일 오후 8:40MozillaKilled 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I think you can do this with the PSCX  extensions package.
  • 2009년 7월 2일 목요일 오전 3:36Mervyn ZhangMSFT, 중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hi,

    Detailed explanation for Vadims script:

    http://www.microsoft.com/technet/scriptcenter/topics/winpsh/convert/wshsave.mspx

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.