WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Shortcut Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Using UNCs in the Target Parameter with ShortcutMake and ShortcutEdit

Keywords:	  ShortcutMake	  ShortcutEdit

General Information:

In the ShortcutMake and ShortcutEdit functions, if the "target" parameter specifies a UNC, and it does not exist at the time this function is called, then the "target" field in the shortcut may not be properly set. Specifically, it may get truncated after the share name. For example, if you use:

ShortcutMake("test.lnk", "\\server\public\testdir\myprog.exe", "", "", 0)
and \\server\public\testdir\myprog.exe doesn't exist, then the target of the share may get set to:

\\server\public
This is due to the behavior of the API function we are calling, and is consistent with the behavior when trying to create or edit a shortcut interactively from Explorer (ie, you are prevented from specifying an invalid target).

Question:

I'm getting the 1411 error - Shortcut File Not Found with the following code:

ShortcutEdit("GUESTC~1.LNK", "", "f:\cpmail\%myname% password", "c:\Windows\desktop", @NORMAL)
What am I doing wrong?

Answer:

Put the full path to your LNK file in the first parameter, i.e. , "C:\WINDOWS\DESKTOP\GUESTC~1.LNK", and put the target directory where the EXE exists in the fourth parameter, for example, "C:\Program Files\CCMail".

Also, use StrCat in the third parameter, rather than using variable substitution. So your new command string should look like:


ShortcutEdit("C:\WINDOWS\DESKTOP\GUESTC~1.LNK", "", strcat("f:\cpmail\",myname,password), "C:\Program Files\CCMail", @NORMAL)

Article ID:   W13852
Filename:   Shortcutmake - ShortcutEdit and using UNC as Target.txt
File Created: 2001:01:31:10:39:52
Last Updated: 2001:01:31:10:39:52