shortcut refer to a network drive

dmosic's picture

Hi @ll

I'm facing a problem in creating a shortcut in WPS7 SP3

wich refers to a network drive. The shortcut have to refer to network path "M:\Definition\Winterthur.bwp"

ShorcutDetails.jpg

After installtion the shortcut refers to "M:\Definiti\Winterth.bwp" . The Folder and File names has been cut at 8 chracters.

afterInstall.jpg

Any idea how can i slow the problem?

Thnks

Siddram's picture

Go for VBScript/Wise Script

Go for VBScript/Wise Script, With this you can solve your problem.

Thanks
Sid

Siddram's picture

You Can use this ...

here is the vbscript that you can make use

Set oWS = WScript.CreateObject("WScript.Shell")
sLinkFile = "C:\Documents and Settings\All Users\Start Menu\Programs\ISIS.LNK"
Set oLink = oWS.CreateShortcut(sLinkFile)
oLink.TargetPath = "\\Definiti\Winterth.bwp" 'network drive path for example: "\\Myserver\myfolder\Definiti\Winterth.bwp"
oLink.Arguments = ""
oLink.WindowStyle = "1"
oLink.WorkingDirectory = "\\Definiti\"
oLink.Save

dmosic's picture

Thanks

Siddram

Thank you very much!

EdT's picture

As a general point, I would

As a general point, I would try and avoid creating shortcuts to network resources, as you can run into problems if the network resource is not available for some reason.
An alternative solution is to create a simple launcher program to install with your application - it can be as simple as a batch file. Then you can create a normal advertised shortcut to the batch file, and set an icon if required. The batch file in turn, when activated, checks to see if the network resource is available and if it is, launches the executable. If it is not accessible, the batch file can exit gracefully with an appropriate message. Instead of a batch file, you can use a bit of compiled Wisescript or any other solution that works for you.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

piyushnasa's picture

add .lnk file

The best way and most easy way to do this would be to create a .lnk file and add it to your package. I have faced this issue and this came out to be the best solution.

Piyush Nasa
Altiris Certified Professional (ACP)

EdT's picture

Creating a .LNK file can

Creating a .LNK file can sometimes be problematic if the network is not available when the shortcut is activated. Windows, in these circumstances, will report that the resource cannot be found and will often search for an alternative, if the user responds incorrectly. In an end user situation this can result in a loss of shortcut settings.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

piyushnasa's picture

it will always happen

In any case if you create a shortcut which has to point to the network drive, then the scenario which you mentioned will always happen...
It will always search for the network drive. If the shortcut is being asked to point the network drive then, that is what we have to deliver.

Piyush Nasa
Altiris Certified Professional, WPS 7.0

Piyush Nasa
Altiris Certified Professional (ACP)

EdT's picture

Not necessarily. I consider

Not necessarily. I consider it important to advise a client of the risks and options. If they then insist on a direct shortcut to a network resource, then they have done this with full knowledge of the risks. Alternatively, if they agree to having a local bat or cmd file as the "launcher" then they have avoided a problem, and you have a more reliable solution.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

SUCHIKANT_VANARSE's picture

Detail process

Just go through below scenario..... may be it will help you...

Create Substituting exe, through vbscript.

1] At 1st we have to pass the path of the executable through registry.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Circle]

[HKEY_LOCAL_MACHINE\SOFTWARE\Circle\PDRIVE]
"NETWORKDRIVE"="P:\\"

2] Now keep the required file to location, for example, "P:\BASF\Folio viewer_4.30.120_GER_1.0.0\Circle\test.ini"

Code for vbscript to which your shortcut should point:

dim wsh, WINDIR,PDrive

set wsh = createobject("wscript.shell")

set fso = createobject("Scripting.FileSystemObject")

PDrive = wsh.RegRead("HKLM\SOFTWARE\Circle\PDRIVE\NETWORKDRIVE")

Windir = wsh.ExpandEnvironmentStrings("%windir%")

if fso.fileexists(PDrive & "\BASF\Folio viewer_4.30.120_GER_1.0.0\Circle\test.ini") then

wsh.exec Windir & "\NOtepad.exe " & chr(34) & pDrive & "\BASF\Folio viewer_4.30.120_GER_1.0.0\Circle\test.ini" & chr(34)

End if