Recursos para Profesionales de TI > Página principal de foros > Windows PowerShell > How to create shortcut in startup menu using powershell?
Formular una preguntaFormular una pregunta
 

RespondidaHow to create shortcut in startup menu using powershell?

  • lunes, 29 de junio de 2009 18:53Leonjl Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    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

Respuestas

  • lunes, 29 de junio de 2009 21:04Vadims PodansMVPMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     RespondidaTiene código
    $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

Todas las respuestas

  • lunes, 29 de junio de 2009 19:18Marco ShawMVP, ModeradorMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    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?
  • lunes, 29 de junio de 2009 21:04Vadims PodansMVPMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     RespondidaTiene código
    $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
  • martes, 30 de junio de 2009 20:40MozillaKilled Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I think you can do this with the PSCX  extensions package.
  • jueves, 02 de julio de 2009 3:36Mervyn ZhangMSFT, ModeradorMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    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.