Jump to content

Automatically copy a filename and launch a web search about the file

I would like to do it via the explorer context menu when I right-click on the file, possibly with a batch file or VBS ? and add it with "Easy context menu" Did Anyone know a way to do it ? Any help would be appreciated

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, Jacques Cartier said:

I would like to do it via the explorer context menu when I right-click on the file, possibly with a batch file or VBS ? and add it with "Easy context menu" Did Anyone know a way to do it ? Any help would be appreciated

You can add a batch file to your context menu via the following registry edit:

[HKEY_CLASSES_ROOT\Directory\shell\Run Batch script]
@="&Run Batch script"

[HKEY_CLASSES_ROOT\Directory\shell\Run Batch script\command]
@="\"H:\\BATCH_FILE_PATH\\context-batch.bat\" \"%1\""

Where "&Run Batch Script" is the what you would like to appear in the menu and the second part is the location of the script. 

 

To get a .bat file to google something is to just have it open "https://www.google.com/search?q=YOUR SEARCH HERE" in your choice of web browser, so bang this into .bat to google:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" https://google.com/search?q=hello

You will just need to write the part that takes a file as input, gets it's name and googles it for you

Ryzen 5 1500x, Noctua NH-L9x65 SE-AM4, GA-AB350N, 16GB 1600Mhz, EVGA GTX 970, 250GB Samsung 960 Evo, 120GB Samsung 840 Evo, 1TB WD Green & 2TB Seagate Barracuda. 650w OCZ ZX & Cooler Master Elite 130. Acer CB241HQK 4K, LG IPS234V-PN 1080p, Ducky Zero Shine All Blue/Anne Pro Brown/SteelSeries Apex Pro & Razer Naga 2014

Link to comment
Share on other sites

Link to post
Share on other sites

14 hours ago, Joshua said:

You will just need to write the part that takes a file as input, gets it's name and googles it for you

Someone on reddit found the solution:

 

Google search any files or folders on your computer. Show/Hide File Extensions.

-Download and install Autohotkey

-Open Notepad

-Copy and paste this code

FileName=%1%
FileName:=RegExReplace(FileName,"&","%26")
FileName:=RegExReplace(FileName,"#","%23")
SplitPath FileName,Name
  Run h t t p s:// www. google. com/ search?q=%Name%

(You have to remove the spaces in Web address)

-Save as "Google Search (Show File Extensions).ahk"

-Close Notepad

-Right-Click on it, Click Compile script.

-Create a shortcut to that and remove the .exe from the shortcut; copy or move that to the "Send to" folder
"C:\Users\[username]\AppData\Roaming\Microsoft\Windows\SendTo\"


-Open Notepad

-Copy and paste this code

FileName=%1%
FileName:=RegExReplace(FileName,"&","%26")
FileName:=RegExReplace(FileName,"#","%23")
SplitPath FileName,Name,Dir,Ext,NameNoExt
If InStr(FileExist(FileName),"D") ;Dir?
  Run h t t p s://www. google. com/ search?q=%Name%
Else                              ;File
  Run h t t p s://www. google. com/ search?q=%NameNoExt%

(You have to remove the spaces in Web address)

-Save as "Google Search (Hide File Extensions).ahk"

-Close Notepad

-Right-Click on it, Click Compile script.

-Create a shortcut to that and remove the .exe from the shortcut; copy or move that to the "Send to" folder
"C:\Users\[username]\AppData\Roaming\Microsoft\Windows\SendTo\"

-To use the script right-click on any files or folders, Click on "Send to", Click the shortcut.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×