Jump to content

How to create shortcuts to nowhere?


daddydave

Recommended Posts

This is a going to sound like a crazy question, I admit, but you know how when you go through the New Shortcut wizard, and it says "Type the location of the item:", it doesn't let you create a shortcut to an item that doesn't exist? Is there any registry tweak that will cause the Windows shell to let you create the shortcut anyway even though it's invalid?

In case you are wondering, what I am trying to do is create an application addon that copies a bunch of shortcuts to Start Menu\Programs which will be valid at the time of installation, but not necessarily on the machine I create the addon with. I have already discovered nircmd will let me create the invalid-at-design-time shortcuts, but I am curious if there is some trick to force the Windows 2000 or XP shell to do the same.

Link to comment
Share on other sites


Ok, Im new to this, but the way which I did it was to...

make a shortcut (.lnk) to where you want it to go then use a batch to copy the shortcut in....(meaning you have a batch file and a shortcut file on your unattended install)

Link to comment
Share on other sites

make a shortcut (.lnk) to where you want it to go then use a batch to copy the shortcut in....(meaning you have a batch file and a shortcut file on your unattended install)

That's exactly hat I'm doing, but the problem is that if I try to create the shortcut to blah.exe without first copying the item to which the shortcut points to C:\Program Files\Blobbity, I get the error "%ProgramFiles%\Blobbity\blah.exe" cannot be found. I am creating the shortcuts ahead of time, rather than creating them during the install of the addon.

There's probably no such tweak for what I'm asking for, so I'll go ahead and create the shortcuts with something else such as nircmd.

And of course it won't kill me to go ahead and copy the program files to %ProgramFiles% at design time, but if there are multiple folders under program files, I have to make the shortcuts one folder at a time.

Interesting nickname you have, I tend to call my working folders "blah", I guess we have something in common.

Edited by daddydave
Link to comment
Share on other sites

Attached is a small app and batch file. The batch file is an example of how to create a shortcut.

put both in $OEM$\$$\system32 (after you edit the batch file for the shortcuts you want to create)

add

call shortcuts.cmd
in your GuiRunOnce.cmd (or in the GuiRunOnce part of the winnt.sif file)

This will create the shortcuts when your apps are installing (call after the apps are installed, if they are apps in the system32 dir then they are copied before this command file runs)

shortcut.zip

Link to comment
Share on other sites

Thanks, phkninja, but what is the shortcut command in the batch file, a third party utility? The reason I am copying the shortcuts at instatll time is to avoid having to embed a third party utility in the addon (other than batchrunner, which gets put in automatically by Addon Maker for nLite and serves the same function as cmdow.)

EDIT: looks like shortcut is a resource kit utility but same principle applies, I am trying to reduce dependencies on other tools so this can be as general as possible. Thanks anyway

Edited by daddydave
Link to comment
Share on other sites

Why not just script the shortcut creation at installation time!

You could use a 3rd party utility such as this in a batch file; or built in tools such as vbs or inf?

xxcopy.exe has a packed size of 123k. Rather than putting 123k of overhead in every addon of this type, I would be better off using a real installer like the excellent NSIS, really simple to use if I use the script wizard in HM NIS Edit, and 34K overhead. (not to mention the fact that the free xxcopy is only free for personal use, which would prevent people from ever using the addons commercially.) Shortcut.exe from OptimumX, which may be the one phkninja is using, has about a 21k packed size, so that would more viable. Even nircmd, which has numerous functions other than shortcut creation, has a packed size under 24K.

You also mentioned INF and VBS at installation time, which sound like good options, since they are built into Windows, and I'm not too familiar with INF files that create shortcuts so I am going to figure out how to do that. Thanks for the tips.

Edited by daddydave
Link to comment
Share on other sites

?

XXMKLINK.EXE, the utility I linked to, is only 48KB

Ah, ok, I only saw XXCOPY on that page, but now I see the other program at the very bottom.

If you need help with the inf file stuff, I know there have been examples, including my own, posted here on these forums.

I figured as much :) Thanks!

Link to comment
Share on other sites

Yes dave im using shorcut. you add it once to the system32 diractory (put an oem folder on the iso) and call it when apps are installing. Its a simple commandline program.

I dont understand why you need to add it to every addon, once its in the system32 directory its can be use with a simple call. (like calling regedit or notepad, just call the exe.) The reason for putting it in system32 is system32 is always in the %PATH% environment variable, so it will always find an exe in system32.

Link to comment
Share on other sites

I dont understand why you need to add it to every addon, once its in the system32 directory its can be use with a simple call. (like calling regedit or notepad, just call the exe.) The reason for putting it in system32 is system32 is always in the %PATH% environment variable, so it will always find an exe in system32.

Well, I have downloaded many application addons, and every one I've seen is self-contained. The only one I have seen that has a prerequisite is one I created for myself that ended up needed reg.exe (on Windows 2000, where it is like a resource kit utility unlike XP where it is part of "Windows").

People are not going to use the tool I am creating (a generalized install.cmd) if every addon they create with it has that kind of dependency. Then again, they might not use it anyway :)

Edited by daddydave
Link to comment
Share on other sites

I looked at creating INF's, but I don't want to redesign my generalized install.cmd too much

I still think it's best for my application to use at the time of addon creation rather than during installation

With that in mind, I took another look at Shortcut.exe because I couldn't figure out how to make get nircmd to create shortcuts with a Target in %ProgramFiles% rather than C:\Program Files. It looks good, it clearly documents how to do that.

If you check out the link above to the generalized install.cmd, you'll see I want the __sp folder to be populated with shortcuts, and I have a __pf folder to be copied to %ProgramFiles%. So I'm all about right clicking the __pf folder and choosing "Make shortcuts in corresponding __sp folder" or something like that. I expect that to be pretty simple using Shortcut.exe. Thanks for all the suggestions :thumbup

Edited by daddydave
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...