Custom SendTo Execution Shortcuts – Windows

Start out with doing “Windows Key + R” and type “shell:sendto”

Next, this folder will pop up:

Create a new Batch File in this directory – I’ve called mine “Launch with Bash.bat” – below is some example code:

@ECHO OFF
SETLOCAL

SET filedrive=%~d1
SET filepath=%~p1
SET filedrive_and_filepath=%filedrive%%filepath%

SET filename=%~n1
SET fileextension=%~x1
SET filename_and_fileextension=%filename%%fileextension%

cd /d %filedrive_and_filepath%
"C:\Program Files\Git\bin\bash.exe" -c "sh ""%filename_and_fileextension%"" "

Note a few things – Batch files can take a starting argument like methods in programming so basically when you right click and do “SendTo” on Windows, it sends the filepath of what you are “Sending” to whatever the destination is.

In a batch file, these parameters are accessed through %1 %2 %3 etc for each positional parameter that is being passed to the “method”

This prewritten file will allow you to create a custom process that easily allows you to launch something with a programmatic process. AKA custom builds, processes, launch parameters, etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s