返回列表 发帖

[文本处理] 求助如何用bat添加桌面浏览器,属性 ,快捷方式,目标中的字符

如何用bat添加桌面浏览器,属性 ,快捷方式,目标中的字符,试了很多方法有的不行有的只能添加部分字符。

保存成1.vbs,文件编码是ANSI
修改的快捷方式必须已经存在.
On Error Resume Next
Dim fso,shell,folder,folderItem
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("Shell.Application")
Set folder = shell.NameSpace(16) ' 桌面
Set folderItem = folder.ParseName("浏览器.lnk") ' 快捷方式名
If folderItem.IsLink Then
  Dim shellLink
  Set shellLink = folderItem.GetLink
  shellLink.Arguments = "--incognito https://www.baidu.com" ' 修改参数
  shellLink.Save
End IfCOPY
微信:flashercs
QQ:49908356

TOP

本帖最后由 czjt1234 于 2024-11-23 17:28 编辑
s = "Google Chrome.lnk"    '浏览器的名称
Set oWshShell = CreateObject("WScript.Shell")
oWshShell.CurrentDirectory = oWshShell.SpecialFolders("AllUsersDesktop")
Set oWshShortcut = oWshShell.CreateShortcut(s)
oWshShortcut.TargetPath = "C:\Windows\system32\cmd.exe"    '目标
oWshShortcut.Arguments = "/k"                              '命令行参数
oWshShortcut.WorkingDirectory = "C:\"                      '起始位置
oWshShortcut.Hotkey = "CTRL+ALT+F"                         '快捷键
oWshShortcut.WindowStyle = 1                               '运行方式
oWshShortcut.Description = "备注"                           '备注
oWshShortcut.IconLocation = "C:\Program Files\Internet Explorer\iexplore.exe,1"
oWshShortcut.Save()COPY
运行方式可选值有3个:
1 窗口化 (缺省值)
3 最大化
7 最小化

IconLocation是快捷方式的图标
缺省值为TargetPath属性指定的文件的第一个图标
可以指定其它图标,如 "C:\Program Files\Internet Explorer\iexplore.exe,2"
其中的2表示该文件的第三个图标,第一个图标的序号为0

快捷键不区分大小写
比如 CTRL+ALT+F
比如 CTRL+Numpad2 表示 Ctrl + 小键盘的数字键2

QQ 20147578

TOP

回复 1# 无天

参见本坛一枚老帖 http://www.bathome.net/thread-33298-1-1.html 其中示范了桌面快捷方式各种属性值的修改方法...

TOP

powershell 能实现

TOP

返回列表