1.

Solve : Running Shortcut in batch File?

Answer»

Hi, I need help, please

I want to running shortcut (the name file with extension lnk) in batch file
So If I run the batch file, the script will be call the shortcut like example i want to run winzip.lnk (not exe file)

thanksPath-to-file\winzip.lnk



Quote from: T.C. on June 14, 2010, 05:06:35 PM

Path-to-file\winzip.lnk





Thanks T.C

That's already tested but not working Try this:
rundll32 shell32.dll,ShellExec_RunDLL "C:\YOURSHORTCUTHERE.lnk"
or if it's a web shortcut, replace .lnk with .url .Quote from: djj99 on June 14, 2010, 07:20:47 PM
That's already tested but not working

Please explain what happens when you try it, post your script.

Quote from: T.C. on June 14, 2010, 07:33:38 PM
Please explain what happens when you try it, post your script.



Thanks T.C
the error same (see below)

Quote from: Helpmeh on June 14, 2010, 07:28:22 PM
Try this:
rundll32 shell32.dll,ShellExec_RunDLL "C:\YOURSHORTCUTHERE.lnk"
or if it's a web shortcut, replace .lnk with .url .

thanks helpmeh
I already tested and still not working
The error SAID " windows cannot open this file : YOURSHORTCUTHERE.lnk "



Please help me

when T.C said:

Quote
Path-to-file\winzip.lnk


you'll notice that you probably don't have a folder called "path-to-file" and that your winzip.lnk is certainly not in it. additionally, when Helpmeh said

Quote
YOURSHORTCUTHERE.lnk

he actually meant for you to put your shortcut's name there.

Short story: you can run a lnk/shortcut just as easily as you can a executable. just type the name.Here's ANOTHER example. When running as Administrator I have a shortcut to Winzip.exe on my desktop. To access the file Winzip.lnk in a batch script I would use:

"c:\documents and settings\administrator\desktop\Winzip.lnk"

where c:\documents and settings\administrator\desktop\ is the path-to-file and winzip.lnk is the filename of the shortcut to Winzip.exe.

The " " are necessary as there are spaces in the path, standard requirement of the command shell.Quote from: djj99 on June 14, 2010, 09:24:21 PM
The error said " windows cannot open this file : YOURSHORTCUTHERE.lnk "

Now I put the shortcut in drive c in root

and I put the screen capture the error message

[recovering disk space - OLD attachment deleted by admin]Did you create a new file and forced it to have a .lnk extension, or did you properly create a new shortcut?Djj99 - How did you create this shortcut? Did you right click the Winzip.exe file and use SEND To Desktop (Create Shortcut) or Create Shortcut then COPY it to the root of C: or right click on a space on the desktop and create your own shortcut manually or open C: and create a new shortcut there??

No-one has reported any problems in creating or executing shortcuts so what procedure are you using to create them?

If you really want help you have to tell us what you are doing...


Have you read this or any of these?


Discussion

No Comment Found