javascript - Unable to create shortcut on Desktop for a remote IP file -


i using below code create help.lnk (which refers mainhelp.html) remote ip local system. facing below problems:

  1. the same code running on friends pc not mine.its saying = "automation server can't create object"
  2. on friend's pc "help.lnk" targeting "c:\172.xx.xx.xx\abc\html\mainhelp.html" ,which wrong "c:" must not come because mainhelp.html present @ remote ip.so, giving target not found error

    function fngo() {

    var wshshell = new activexobject("wscript.shell");  strdesktop = wshshell.specialfolders("\\172.xx.xx.xx\\abc\\html");  var oshelllink = wshshell.createshortcut(strdesktop + "help.lnk");  oshelllink.targetpath = "\\172.xx.xx.xx\\abc\\html\\mainhelp.html";  oshelllink.windowstyle = 1;  oshelllink.hotkey = "ctrl+shift+g";  oshelllink.description = "shortcut script";  oshelllink.workingdirectory = strdesktop;  oshelllink.save();  

    }

    please help

try changing following lines

strdesktop = wshshell.specialfolders("desktop");  var oshelllink = wshshell.createshortcut(strdesktop + "\\help.lnk");  oshelllink.targetpath = "\\\\172.xx.xx.xx\\abc\\html\\mainhelp.html";  
  • you need indicate correct folder in save shortcut

  • it necessary separate name of shortcut file , name of folder

  • in javascript, every backslash needs escaped, every backslash needs doubled.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -