Results 1 to 10 of 10

Thread: Delete shortcut in Startup

  1. #1

    Default Delete shortcut in Startup

    Hi,

    I would like to have my script delete a previously created shortcut in
    Startup.

    And this is not to be done by uninstalling but by a later run of the
    install based on a condition.

    Is this possible ?

    Cheers
    /Poul

  2. #2

    Default Re: Delete shortcut in Startup

    Hi Poul,

    > I would like to have my script delete a previously created shortcut in
    > Startup.
    >
    > And this is not to be done by uninstalling but by a later run of the
    > install based on a condition.
    >
    > Is this possible ?

    Absolutely no problem. A Shortcut is nothing more than a file with a .lnk
    extension. Just use the "Delete File(s)..." script function.

    Similar to this:

    http://www.lindersoft.com/forums/sho...-Icons&p=45551

    Does this help?

    Friedrich

  3. #3

    Default Re: Delete shortcut in Startup

    Hi Friedrich,

    Thanks very usefull.

    BUT it turns out that this does not solve my problem in this case: If
    I install a program on a terminal server and create a shortcut in
    "Startup" it turns out that this now works for all users on the
    terminal server.
    Is it possible to create the Startup shortcut for the user running the
    installation only ?

    Cheers
    /Poul

  4. #4

    Default Re: Delete shortcut in Startup

    Hi Poul,

    > Thanks very usefull.
    >
    > BUT it turns out that this does not solve my problem in this case: If I
    > install a program on a terminal server and create a shortcut in "Startup"
    > it turns out that this now works for all users on the terminal server.
    > Is it possible to create the Startup shortcut for the user running the
    > installation only ?

    if you install elevated ("per-machine") then the current user is "all users"
    <g> because you are accessing the administrator's profile when you launch
    the setup.

    You can only do "per-user" actions in Windows when you create a non-elevated
    installer (please note that you do not have any access to protected areas in
    this case). BTW, this is by Windows design and the expected behavior!

    What you can do is to use a dirty trick. Create a separate helper
    executable with SetupBuilder (e.g. a Blank Script). Set the elevation level
    to "asInvoker". Then add the Delete File(s) script function to remove the
    Shortcut. Compile the helper executable and add it to your main installer
    (e.g. as a Support File). Call this helper application from your main
    setup.exe -- but enable "Launch non-elevated under UAC". It will then run
    under the current user profile.

    BTW, if your first installer created that Shortcut then your update
    installer can also remove it if both use installers the same execution
    level.

    Friedrich

  5. #5

    Default Re: Delete shortcut in Startup

    You can request elevated rights for some function at runtime:

    Create sudo.cmd with contense:
    LinePrint('@echo Set objShell = CreateObject("Shell.Application") >
    %temp%\sudo.tmp.vbs','sudo.cmd')
    LinePrint('@echo args = Right("%*", (Len("%*") - Len("%1"))) >>
    %temp%\sudo.tmp.vbs','sudo.cmd')
    LinePrint('@echo objShell.ShellExecute "%1", args, "", "runas" >>
    %temp%\sudo.tmp.vbs','sudo.cmd')
    LinePrint('@cscript %temp%\sudo.tmp.vbs','sudo.cmd')



    Create batch file with commands to execute
    In my case, this registerd .Net COM
    LinePrint('sudo cmd /c '&Clip(LocotNetPath) &' '& Clip(Loc:ComDLL) & '
    /register /codebase /tlb','comregister.bat')
    LinePrint('exit','comregister.bat')

    Allways place exit in the end, vb script can keep the window open.

    Run your batch file.

    Kzendra

    --
    It ain't the fall that kills you
    It's the sudden stop at the bottom.

  6. #6

    Default Re: Delete shortcut in Startup

    Thanks for the explanation Friedrich.
    Will give it a go with a separate script.

    Cheers
    /Poul

  7. #7

    Default Re: Delete shortcut in Startup

    Hi Friedrich,

    I have now made the helper script. The only item in this is the
    shortcut in Startup. The script has in General information > Generator >
    Execution level = asInvoker.

    In the main script I call the helper script like this:
    Run Program
    ("%_SB_INSTALLDIR%\MariSoft\MobilService-automode.exe", "")
    [Feature:Always Install] [Hide] [Non-Elevated]

    But it still creates the Startup in common:
    Startup Common Mobilservice
    AutoMode.lnk C:\PStellar7\MariSoft\StartMserviceAutomode.bat

    What am I missing here ?

    Cheers
    /Poul

  8. #8

    Default Re: Delete shortcut in Startup

    Hi Poul,

    did you set the helper app to per-user mode (add a "Set Installer Flag"
    script function and use "$SB_ALLUSERSFLAG$" -- do not mark the "Set User"
    checkbox).

    Friedrich

  9. #9

    Default Re: Delete shortcut in Startup

    Now I did and it now works great.
    Thank you :-)

    /Poul

  10. #10

    Default Re: Delete shortcut in Startup

    > Now I did and it now works great.
    > Thank you :-)

    Perfect! Thanks for the good news, Poul :-)

    Friedrich

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •