I'm trying to set up a context menu for Everthing.exe to search over multiple folders selected on file explorer, without implementing any shell extension and without the program's own context menu. I need the context menu on a particular location.
Searching multiple folders works directly on Everything by separating the folders with a "|", like this:
But when I run the context menu, the program gets only the first and last double quotes, like this:"D:\folder1"|"D:\folder2\"
I'm using a .vbs file to run everything.exe from the context menu (I do this with many programs).. I've tested the output and the vbscript sends the correct arguments to the program, but it seems the program strips those double quotes... It works fine if only one folder is sent, but when there's more than one I have to manually add the missing double quotes on the program's interface once it's opened.."D:\folder1|D:\folder2\"
I include the VBScript file:
Code: Select all
'+============================================
'| MN_Run for Everything
'| Date 2020-01-01 18:57
'| Last 2020-01-01 19:52
'| Author Melvin D. Nava <mdnava[at]gmail.com>
'| URL https://www.mdnava.com/
'+============================================
'| Desc: Search multiple folders from the context menu
'| Note: Folders as argument are separated by | (everything.exe -p "path1"|"path2"|"path3")
'| However, for some reason the program strips double quotes for a multiple folder search..
'| Args: <folders_to_search>
'+============================================
Option Explicit
If WScript.Arguments.Count < 1 Then MsgBox "Missing parameter, nothing to do!.", vbInformation, "Notice" & WScript.Quit()
Dim arrArgs, objFSO, objShell
Set arrArgs = Wscript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
MN_Run()
Private Sub MN_Run()
Dim sScriptFolder, sArg, sArgs, nCount
sScriptFolder = objFSO.GetParentFolderName(objFSO.GetFile(Wscript.ScriptFullName)) & "\"
nCount = 1
For Each sArg In arrArgs
If nCount > 1 Then
sArgs = sArgs & "|""" & GetFolder(sArg) & """"
Else
sArgs = """" & GetFolder(sArg) & """"
End If
nCount = nCount + 1
Next
objShell.Run sScriptFolder & "Everything.exe -p " & sArgs, 1, False
End Sub
Function GetFolder(sFolderArg)
If Not (objFSO.FolderExists(sFolderArg)) Then WScript.Echo "Invalid folder: " & sFolderArg & WScript.Quit
GetFolder = sFolderArg
End Function
Set objFSO = Nothing
Set objShell = Nothing