Skip to content

Macros.ini File Configuration

Robert C. Maehl edited this page Aug 13, 2023 · 6 revisions

Details

Macros.ini is a file located in %localappdata%\PowerToysMacros\ that defines Macros to be used. They can be executed using macro:MacroName optional additional data here in PowerToys Run.

Macro Definition Template

[MacroName]
Type=
Verb=
Data=
RunAfter=

Types Overview

Type Description Added Modified
Command Executes a Command defined in Data, the same as Win+R 0.1.0.0 0.3.0.0
RawText Inputs Plaintext defined in Data 0.2.0.0 -
SpecialText Inputs Formatted Text defined in Data 0.2.0.0 -

Verbs Overview

Verb is only used with the Command Type.

If not specified, the default verb for the file/command is used

Verb Description Added Modified
edit Launches an editor and opens the document for editing. 0.3.0.0 -
find Initiates a search starting from the specified directory. 0.3.0.0 -
open Launches an application. If this file is not an executable file, its associated application is launched. 0.3.0.0 -
print Prints the document file. 0.3.0.0 -
properties Displays the object's properties. 0.3.0.0 -
runas Launches an application as Administrator. User Account Control (UAC) will prompt the user for consent to run the application elevated or enter the credentials of an administrator account used to run the application. 0.3.0.0 -

Data Overview

Data is the Data to be Typed or Executed depending on the Macro Type specified. Additional Data can be sent to the macro by defining it in PowerToys run.

By default, all Additional Data sent is set as {0}. Additionally, Specific Data can be selected using {#} in which # specifies which space-separated Data to use. Multiple Parts of Data can be returned using {#...#}. Data that does not exist returns an empty string.

Receiving Additional Data

In this Example: macro:g cute cat feet videos has the following Data:

Value Data
{0} cute cat feet videos
{1} cute
{2} cat
{3} feet
{4} videos
{5} Nothing
{1...2} cute cat
{1...4} cute cat feet videos
{1...999} cute cat feet videos
{3...4} feet videos
{1...16777216} This will crash

Setting Data to {0} by itself is not allowed

RunAfter Overview

RunAfter can be set to run multiple Macros in succession. The same parameters from PowerToys run will be sent to each Macro. In the Example below, macro:SA Cat Pics will search Google, Bing, and Yahoo for Cat Pics.

[SA]
Alias=SearchAll-G

[SearchAll-B]
Type=Command
Data=https://www.bing.com/search?q={0}
RunAfter=SearchAll-Y

[SearchAll-G]
Type=Command
Data=https://www.google.com/search?q={0}
RunAfter=SearchAll-B

[SearchAll-Y]
Type=Command
Data=https://search.yahoo.com/search?p={0}