How do I create a shortcut with *.htm as target?

Started by Divv, March 21, 2014, 05:33:15 AM

Previous topic - Next topic

Divv

Hi,

First of all. I'm new to WinBatch so bear with me.

I want to create a shortcut for a *.htm file on the Public users Desktop. The location for the htm file is C:\document.htm. Earlier I have always used the ShortcutMake function, but this time I'm running into problems. I receive error "Error saving shortcut file". I guess this is because the target for the shortcut is not a *.exe file or directory?

How would this code look like? Must I call iexplore.exe in some way, since that is the actual application for the shortcut?

Please note, I don't want to create an URL, just a shortcut to a *.htm file.

td

The user account running the script likely doesn't have write permission on the root directory of the C drive.  If so, you would need to find another location for your shortcut or use a different account to run your script.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Divv

Sorry, this was a mistake by me

I wrote that I wanted to create the shortcut under C:\ in this thread because it would be simpler to explain. But I was actually trying to create the shortcut under C:\Users\Public\Public Desktop. The problem is that the name for that folder is really C:\Users\Public\Desktop

When you just look at it in explorer it says it's named "Public Desktop"... very confusing...  :)

Deana

Apparently that folder is restricted because it affects all users on the system. So this code should run Elevated (Manifest setting highest Available/Require Admin):

Code (winbatch) Select

htmlfile = 'C:\Users\Deana\Documents\CoffeeCup Software\HTML Editor\Projects\Resume\about.html'
pubdir = ShortcutDir('{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}',0,@TRUE )
linkname =  pubdir : 'sample.lnk'
ShortCutMake( linkname,  htmlfile, '', '', @normal  )
Exit
Deana F.
Technical Support
Wilson WindowWare Inc.