none
Creating Start Menu shortcut to cmd

    Question

  • I'm creating a deployment project whose start menu shortcut launches a bat file. In order to make this shortcut pinnable to the tasbar, I want to make the target of the shortcut:

    %ComSpec% /c "C:\Program Files (x86)\ClearCase Services\clearcase_start.bat"

    Is there any way to make a target like this without embedding a copy of cmd.exe in my project?

    Brian

    Monday, May 14, 2012 8:14 PM

Answers

  • Brute force works. Create a post-install custom action as a vbs script with this code. It works.

    Dim Profiles86
    Dim PF_Path
    Dim strStart_Path
    
    Set WshShell = CreateObject( "WScript.Shell" )
    ProFiles86 = WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")
    PF_Path = Profiles86 & "\ClearCase Services"
    Set objWshSpecialFolders = WshShell.SpecialFolders
    
    strStart_Path = objWshSpecialFolders("AllUsersPrograms")  & "\ClearCase Services 3.1"
    
    Set oShellLink = WshShell.CreateShortcut(strStart_Path & "\xxClearCase Start.lnk" )
    oShellLink.TargetPath = "%ComSpec%"
    oShellLink.Arguments = "/c """ & PF_Path & "\clearcase_start.bat"""
    oShellLink.WindowStyle = 1
    oShellLink.IconLocation = PF_PATH & "\Start.ico"
    oShellLink.Description = "Command to start the four ClearCase Windows services"
    oShellLink.WorkingDirectory = PF_PATH
    oShellLink.Save
    
    Set oShellLink = nothing
    Set WshShell = Nothing


    Monday, May 14, 2012 11:01 PM

All replies

  • Brute force works. Create a post-install custom action as a vbs script with this code. It works.

    Dim Profiles86
    Dim PF_Path
    Dim strStart_Path
    
    Set WshShell = CreateObject( "WScript.Shell" )
    ProFiles86 = WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")
    PF_Path = Profiles86 & "\ClearCase Services"
    Set objWshSpecialFolders = WshShell.SpecialFolders
    
    strStart_Path = objWshSpecialFolders("AllUsersPrograms")  & "\ClearCase Services 3.1"
    
    Set oShellLink = WshShell.CreateShortcut(strStart_Path & "\xxClearCase Start.lnk" )
    oShellLink.TargetPath = "%ComSpec%"
    oShellLink.Arguments = "/c """ & PF_Path & "\clearcase_start.bat"""
    oShellLink.WindowStyle = 1
    oShellLink.IconLocation = PF_PATH & "\Start.ico"
    oShellLink.Description = "Command to start the four ClearCase Windows services"
    oShellLink.WorkingDirectory = PF_PATH
    oShellLink.Save
    
    Set oShellLink = nothing
    Set WshShell = Nothing


    Monday, May 14, 2012 11:01 PM
  • Hi Brian,

    I'm glad to hear that you have solved the issue and thank you for sharing the solution with us.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 15, 2012 1:37 PM
    Moderator