'Rem EverythingAutoSetup.VBS 安装Everything的VBS脚本 2019年11月25日写

'Rem Everything是voidtools开发的一款本地NTFS文件和文件夹名称搜索工具

'Rem Everything基于名称快速定位本地NTFS文件和文件夹。

'Rem Everything不具有MasterSeeker的索引完成前抢先式显示部分搜索结果的能力

'Rem http://www.autoahk.com/archives/16500


'Rem https://gitee.com/weiyunwps618/codes/kuapc0qgdmibsz1e53olv49

'Rem https://www.voidtools.com/zh-cn/

'Rem https://www.xyboot.com/

'Rem 请确保此VBS脚本所在文件夹存在Everything.exe和Everything.lng这两个文件

'Rem 安装Everything的VBS脚本

'Rem 为何不使用AutoHotkey

'Rem 因为没有安装AutoHotkey的电脑无法运行AHK脚本

'Rem 因为EXE文件容易被杀毒软件误删

'Rem 新建文件夹D:\DIYTOOLS\Everything

'Rem 之所以把绿色免安装软件分类保存在D:\DIYTOOLS\

'Rem 是为了兼容“杏雨梨云USB维护系统2019中秋版之国庆更新”

'Rem 推荐使用uTools管理电脑中的快捷方式

dim fso,fld

Set fso=CreateObject("Scripting.FileSystemObject")

if fso.folderExists("D:\DIYTOOLS\Everything") Then

'MsgBox "文件夹已经存在"

else

set fld = fso.createfolder("D:\DIYTOOLS\Everything")

End If

'Rem 复制文件到D:\DIYTOOLS\Everything文件夹

parentfolder = "D:\"

sourcefile = createobject("Scripting.FileSystemObject").GetFolder(".").Path&"\everything.exe"

targetfolder = parentfolder & "DIYTOOLS" & "\" & "Everything"& "\"

set objshell = createobject("shell.application")

set objfolder = objshell.nameSpace(parentfolder)

set so=createobject("scripting.filesystemobject")

if IsExitAFile("D:\\DIYTOOLS\\Everything\\Everything.exe") Then

'DeleteAFile("D:\\test.tst")

else

fso.getfile(sourcefile).copy(targetfolder)

End If

sourcefile = createobject("Scripting.FileSystemObject").GetFolder(".").Path&"\everything.lng"

if IsExitAFile("D:\\DIYTOOLS\\Everything\\Everything.lng") Then

'DeleteAFile("D:\\test.tst")

else

fso.getfile(sourcefile).copy(targetfolder)

End If

Function IsExitAFile(filespec)

Dim fso

Set fso=CreateObject("Scripting.FileSystemObject")

if fso.fileExists(filespec) Then

IsExitAFile=True

else IsExitAFile=False

End If

End Function

'Rem 在桌面和开始菜单新建文件D:\DIYTOOLS\Everything\Everything.exe的快捷方式

Set WshShell = WScript.CreateObject("WScript.Shell")

strDesktop = WshShell.SpecialFolders("Desktop")

set oShellLink = WshShell.CreateShortcut(strDesktop & "\Everything.lnk")

oShellLink.TargetPath = "D:\DIYTOOLS\Everything\Everything.exe"

oShellLink.Arguments = " " '程序的参数

oShellLink.WindowStyle = 1 '参数1默认窗口激活,参数3最大化激活,参数7最小化

oShellLink.Hotkey = "F8" '快捷键

oShellLink.IconLocation = "D:\DIYTOOLS\Everything\Everything.exe, 0" '图标

oShellLink.Description = "Everything搜索本地文件" '备注

oShellLink.WorkingDirectory = "D:\DIYTOOLS\Everything\" '起始位置

oShellLink.Save '创建保存快捷方式

'Rem 运行Everything

set shell=CreateObject("WScript.shell")

shell.Run "D:\DIYTOOLS\Everything\Everything.exe"