双击脚本文件安装到’发送到’
脚本文件需要保留,所以先放好位置.
set objShell = WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") ' 创建 app Shell 对象 Set appShell = CreateObject("Shell.Application") '参数 Set objArgs = WScript.Arguments '安装目录 install_dir=objShell.ExpandEnvironmentStrings("%APPDATA%\Microsoft\Windows\SendTo\") ' 获取文件描述信息 function file_desc(filePath) On Error Resume Next dim ext ext=LCase(objFSO.GetExtensionName(filePath)) if ext<>"exe" then exit function end if dim desc desc = appShell.Namespace(objFSO.GetParentFolderName(filePath)).ParseName(objFSO.GetFileName(filePath)).ExtendedProperty("FileDescription") desc=trim(desc) if desc="TODO" then desc ="" end if file_desc=desc On Error GoTo 0 end function '创建快捷方式 function CreateShortcut(src,to_dir,filename, icon) On Error Resume Next ' 获取最后一个字符 lastChar = Right(to_dir, 1) ' 检查最后一个字符是否是 \ 或 / If lastChar <> "\" And lastChar <> "/" Then to_dir = to_dir & "\" End If if filename="" then filename=objFSO.GetBaseName(src) end if set oShellLink = objShell.CreateShortcut(to_dir & filename & ".lnk") oShellLink.TargetPath = src oShellLink.WindowStyle = 1 oShellLink.WorkingDirectory = objFSO.GetParentFolderName(src) if icon<>"" then oShellLink.IconLocation=icon end if oShellLink.Save On Error GoTo 0 end function if objArgs.count=0 then Dim userResponse '安装 userResponse = msgbox ("是否安装到[发送到]",vbYesNo) If userResponse = vbYes Then call CreateShortcut(WScript.ScriptFullName,install_dir,"开始菜单","%SystemRoot%\System32\shell32.dll,304") WScript.Quit End If userResponse = msgbox ("是否打开 开始菜单文件夹",vbYesNo) If userResponse = vbYes Then objShell.Run "explorer.exe """ & objShell.ExpandEnvironmentStrings("%APPDATA%\Microsoft\Windows\Start Menu\Programs") & """",1 WScript.Quit End If end if '开始菜单目录 start_dir_raw=objShell.ExpandEnvironmentStrings("%APPDATA%\Microsoft\Windows\Start Menu\Programs\easy tools raw") If Not objFSO.FolderExists(start_dir_raw) Then objFSO.CreateFolder(start_dir_raw) end if start_dir_desc=objShell.ExpandEnvironmentStrings("%APPDATA%\Microsoft\Windows\Start Menu\Programs\easy tools") If Not objFSO.FolderExists(start_dir_desc) Then objFSO.CreateFolder(start_dir_desc) end if for count = 0 to objArgs.count-1 Step 1 filePath = objArgs.Item(count) call CreateShortcut(filePath,start_dir_raw,"","") '创建原文件名为基础的快捷方式 desc=file_desc(filePath) if desc<>"" then call CreateShortcut(filePath,start_dir_desc,desc,"") end if NEXT
/wp-content/uploads/2024/11/发送到开始菜单.7z
0