AutoHotkey Open a File in a Script Open a File through Windows Explorer


Inside the script, use the first line to store the very first variable (in this example, %1%) with a name to deal with. Example: OpenWithFile = %1%

Once you open a file with this script through Windows (Right click on any file on MS Windows and choose 'Open with...' then select the compiled version of the script such as script.exe) the name of the choosed file will be stored in this variable and, so, the script will be able to work with it. Example:

OpenWithFile = %1%
if OpenWithFile !=
FileRead, content, %OpenWithFile%
msgbox %content%