简体   繁体   English

无法在桌面上为远程IP文件创建快捷方式

[英]Unable to create shortcut on Desktop for a remote IP file

I am using below code to create the help.lnk (which refers to MainHelp.html) from a remote IP to my local system. 我正在使用下面的代码从远程IP到本地系统创建help.lnk(指MainHelp.html)。 I am facing below problems: 我面临以下问题:

  1. The same code is running on my friends PC but not mine.Its saying = "Automation server can't create object" 相同的代码在我的朋友PC上运行,但不是在我的PC上运行。它说=“自动化服务器无法创建对象”
  2. On my friend's PC the "help.lnk" is targeting to "C:\\172.xx.xx.xx\\abc\\html\\MainHelp.html" ,which is wrong as "C:" must not come because the MainHelp.html is present at remote IP.So, its giving Target Not Found ERROR 在我朋友的PC上,“ help.lnk”的目标是“ C:\\ 172.xx.xx.xx \\ abc \\ html \\ MainHelp.html”,因为“ C:”一定不正确,因为MainHelp.html出现在远程IP上,因此其给定目标未找到错误

    function fnGo() { 函数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 the 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 to indicate the correct folder in where to save the shortcut 您需要在保存快捷方式的地方指定正确的文件夹

  • It is necessary to separate the name of the shortcut file and the name of the folder 有必要将快捷方式文件的名称和文件夹的名称分开

  • In javascript, every backslash needs to be escaped, so every backslash needs to be doubled. 在javascript中,每个反斜杠都需要转义,因此每个反斜杠都需要加倍。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 创建桌面快捷方式 - Create Shortcut on Desktop 在桌面上拖放链接以创建快捷方式 - Drag and drop a link on the desktop to create a shortcut 有没有办法为 Node.js (npm) 应用程序创建快捷桌面? - Is there any way to create an shortcut desktop to a Node.js (npm) application? 如何创建链接到我的网站的桌面快捷方式/图标 - How to create a desktop shortcut/icon that links to my website 如何以编程方式在用户桌面上创建Web应用程序快捷方式? - How to create web app shortcut on user's desktop programmatically? 如何通过JS在android / ios上以编程方式为网站创建桌面快捷方式? - how to programmatically create a desktop shortcut for a website on android/ios with js? 为移动和桌面创建可下载文件 - create downloable file for mobile and desktop 某些用户操作更改了链接href后,从Chrome到桌面的拖放链接无法创建正确的桌面快捷方式 - Drag&dropping link from Chrome to desktop does not create a correct desktop shortcut after the link href was changed by some user action 无法创建远程会话 - Eclipse - Appium - unable to create remote session - Eclipse - Appium 无法使用 Electron JS 使用桌面应用程序创建新文件夹 - Unable to create new folder using Desktop App using Electron JS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM