HomeWindows 7 Tutorial

Automatically pass arguments to a program in Windows 7

1Pass argument to Windows program - Step 1

By default, programs you launch typically don't include any parameter (also called "argument" or "switch"). These extra pieces of information let you configure how the application opens. Example: you can force Google Chrome to always restore the last tabs by passing the "-restore-last-session" switch to the application. In this tutorial, you'll learn to add custom switches to a program shortcut. This works in Windows 7/8/10, and older versions of the OS.

2Pass argument to Windows program - Step 2

In Windows 7 and later, you have the following types of shortcuts: those in the start menu, in the taskbar, and the ones on find on your desktop or folders in Windows Explorer. In earlier versions of Windows, you also had app shortcuts in the Quick Launch bar (essentially a shortcut-filled folder in the taskbar.)

Note: the "Internet Explorer No Add-ons" shortcut in your start menu just launches the browser with the "-extoff" switch to disable all extensions.

3Pass argument to Windows program - Step 3

To customize a shortcut, right-click on it and choose "Properties" from the context menu. To specify parameters for the target application, make sure that the "Shortcut" tab is selected in the Properties dialog.

Tip: programs pinned to the taskbar are also shortcuts. Hold down the Shift key when right-clicking on their icon, otherwise you'll get their jump list menu.

4Pass argument to Windows program - Step 4

For the purpose of this tutorial, we're going to create a shortcut to Chrome that prevents the browser from loading its extensions. With the Shortcut tab selected in the Properties dialog, click inside the "Target" text field, and type a hyphen followed by the command line switches you need. On the screenshot, we're creating a Chrome shortcut with the "-disable-extensions" parameter to load it without any add-on loaded (just like the IE No Add-on).

5Pass argument to Windows program - Step 5

Click OK to save your shortcut with the arguments included, and launch the program with it to test that everything works as intended. Remember that this only affects this particular shortcut, so you'll have to manually follow the same steps for all the shortcuts you use to launch that particular app.

*Pass argument to Windows program - Step 6

Bonus Tips:
- Aside from parameters you type, there are "behind-the-scenes" switches you can use for shortcuts, like choosing to make a program start minimized, running it in compatibility mode for an older version of Windows, or running it under a different Windows user (those settings are under the Compatibility tab).
- You can also type program names and switches from the Run dialog.