Jump to content

Is there a way to create a shortcut without the source file?


ajua

Recommended Posts


Here's a little VBscript for creating a shortcut:

On Error Resume Next
Dim ws, fs, progdir, strPrograms, scut1
Set ws = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
progdir = ws.ExpandEnvironmentStrings ("%PROGRAMFILES%")
strPrograms = ws.SpecialFolders("AllUsersPrograms")
Set scut1 = ws.CreateShortcut(strPrograms & "\Internet\Windows Messenger.lnk")
scut1.TargetPath = (progdir & "\Messenger\Msmsgs.exe")
scut1.Save

I've never tried this with the file missing so I can't say for sure if this will work. When I use code similar to this I always put in an IF EXIST. So it may work, it may not. The first line will suppress any error messages.

Edited by RogueSpear
Link to comment
Share on other sites

just create them to existing files, then copy all your shortcuts into a 7z file and extract them in your installation

This is actually what I do for about 95% of the shortcuts not associated with an installer. Quite a bit easier too.

Link to comment
Share on other sites

No, I don't think you've quite got a hold of the actual problem.

elajua, appears to have an installed system already, with which they are preparing a new cd source. In this source, they wish to add some software to be installed with the new cd. What they want to do is put some shortcuts into the source cd to be copied over during the install, however the software they are adding to the cd is not installed on their running system. Without a target on the currently running system they cannot create the shortcuts to those targets.

Their best choice would be to create the shortcuts during the install, using inf, vbs or a 3rd party utility.

Below is a cmd file which will create, run and delete an inf which will create a shortcut to a non-existant file. Run it first, then edit it as you see fit.

@ECHO OFF &SETLOCAL ENABLEEXTENSIONS
SET "OFile=%TEMP%\_Linx_.inf"
>%OFile% ECHO [Version]
>>%OFile% ECHO Signature = $Windows NT$
>>%OFile% ECHO/
>>%OFile% ECHO [DefaultInstall]
>>%OFile% ECHO UpdateInis = TestLink
>>%OFile% ECHO/
>>%OFile% ECHO [TestLink]
>>%OFile% ECHO setup.ini, progman.groups,, "group0=""%%16400%%\"""
>>%OFile% ECHO setup.ini, group0,,"""Non-existant File"",""""""%%16422%%\Parent\Child\MadeUp.exe"""""""
RUNDLL32 SETUPAPI,InstallHinfSection DefaultInstall 132 %OFile% &&DEL "%OFile%"
ENDLOCAL &GOTO :EOF

Edited by Yzöwl
Link to comment
Share on other sites

This tool can create shortcuts to non-existing targets.

thanks, this will do the work for me.

to all other's suggestion will try them if that program doesnt work. the reason i want to make shorcuts without source files is that i do as you say with almost all my software but many freeware appz i use are updated very quickly so sometimes i got them at work i prepare them to use them on my xpcd at home but i dont want to extract/install them at work.

thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...