Jump to content

FileCreateShortcut Issue


Go to solution Solved by ioa747,

Recommended Posts

Good day,

The following snippet does work...

Local $_fpath1 = "G:\Session_Master\Show"
Local $_fpath2 = "E:\Desktop\Show"
;------------------
FileCreateShortcut($_fpath1, $_fpath2)

A shortcut named "Show.lnk" to "G:\Session_Master\Show" is created on the Desktop name "Show.lnk"!

The following snippet  does not work...

Local $_fpath1 = "G:\Test_Master"
Local $_fpath2 = "D:\Install\App_Config\Digital_Audio\6_Testing\Data\Test_Master
;------------------
FileCreateShortcut($_fpath1, $_fpath2)

A shortcut named "Test_Master.lnk" to "G:\Test_Master" IS created....however, the shortcut is created in the "Data" folder!!

Why??

Any assistance in this matter would be greatly appreciated...as always!!

Link to comment
Share on other sites

ioa747,

First, thanks for the reply...appreciated...again...as always!!

Second, why is it that in the first example, I am not required to provide a name for the shortcut?
• Thus, is the shortcut always required?
• I would assume then, that if the HelpFile notes such, that such is required?

From HelpFile: "lnk - Full path and file name of the shortcut"

Link to comment
Share on other sites

From HelpFile: look at the example

Edit:
with  "D:\Install\App_Config\Digital_Audio\6_Testing\Data\Test_Master"
You give the path but not the name

and it thinks the name is Test_Master
and puts it in the Data folder

 

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

  • Solution
Posted (edited)

 

#include <StringConstants.au3>

Local $_fpath1 = "G:\Test_Master"
Local $_fpath2 = "D:\Install\App_Config\Digital_Audio\6_Testing\Data\Test_Master"

MakeShortcut($_fpath1, $_fpath2)

;----------------------------------------------------------------------------------------
Func MakeShortcut($_filePath, $_Linkpath)
    Local $sName = StringTrimLeft($_filePath, StringInStr($_filePath, "\", $STR_NOCASESENSEBASIC, -1))
    ConsoleWrite("$sName=" & $sName & @CRLF)

    FileCreateShortcut($_filePath, $_Linkpath & "\" & $sName & ".lnk")

EndFunc   ;==>MakeShortcut
;----------------------------------------------------------------------------------------

 

Edited by ioa747
I added & ".lnk"

I know that I know nothing

Link to comment
Share on other sites

12 hours ago, mr-es335 said:

The following snippet does work...

Local $_fpath1 = "G:\Session_Master\Show"
Local $_fpath2 = "E:\Desktop\Show"
;------------------
FileCreateShortcut($_fpath1, $_fpath2)

A shortcut named "Show.lnk" to "G:\Session_Master\Show" is created on the Desktop name "Show.lnk"!

it's the same behavior

with  "E:\Desktop\Show"
You give the path but not the name

and it thinks the name is Show
and puts it in the Desktop folder

otherwise it should put it in the E:\Desktop\Show  folder

I know that I know nothing

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
 Share

  • Recently Browsing   0 members

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