Sign in to follow this  
Followers 0
alexm963

FileCreateShortcut is adding a " at the beginning of the target

10 posts in this topic

Ok, so I am trying to make a seemingly simple shortcut. As can be seen in my code snippet.

The target of the .lnk should look like this: %comspec% /c start "" "C: blah blah blah \script.exe"

Instead what I get is this: "%comspec% /c start "" "C: blah blah blah \script.exe"

Any ideas how to get rid of that leading quotation mark?

FileCreateShortcut('%comspec% /c start ' & '""' & ' "' & @DesktopDir & "\" & $Unpack & '.exe"', @DesktopDir & "\" & $Unpack & ".lnk","","","","","{F6}")

 

Share this post


Link to post
Share on other sites



Have you tried it using the 4th (args) parameter instead of stuffing everything into the 1st parameter?

Share this post


Link to post
Share on other sites

I tried looking in to how to use it but I can't find what I would put in there. Is there something in the help file or where?

Share this post


Link to post
Share on other sites

Yes. Did you look at the example?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yes I understand that text can be put in but what are valid arguments to pass to autoit executables?

Edited by alexm963

Share this post


Link to post
Share on other sites

In your earlier example, %compspec% is the actual program being run. The rest could be passed as an argument.

Share this post


Link to post
Share on other sites

The program in opening with the shortcut is my script.exe. Running it through comspec just made it open a new instance of the script instead of just making it active if it is already open. My script.exe looks for other instances of itself and closes them right when it starts. If I try to run the shortcut with a hot key it doesn't open a new instance. It makes the current one active. I want it to open a new instance. 

Share this post


Link to post
Share on other sites

@alexm963 And what does this have to do with your original issue? Has that been resolved?

Share this post


Link to post
Share on other sites

This was the solution I found for this issue. If I manually make a shortcut with a target of :  %comspec% /c start "" "C: blah blah blah \script.exe" then the program will run as a new instance with the shortcut. 

Share this post


Link to post
Share on other sites

Solved.

I ran FileGetShortcut to get the parameters that it was running when I made it manually. This works.

FileCreateShortcut(@WindowsDir & "\system32\cmd.exe", @DesktopDir & "\" & $Unpack & ".lnk","","'/c start "" "' & @DesktopDir & "\" & $Unpack & '.exe"'","","","{F6}")

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0