Creating External Shortcuts with Parameters

David Meego - Click for blog homepageThis is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.

I was asked recently if it was possible to create a Shortcut from Microsoft Dynamics GP to launch an external application and pass parameters to the application.

The usual method of achieving this with a Windows Shortcut is to add a space and then add the parameters to the Target field.  If you try the same approach with a Dynamics GP shortcut by adding the parameters to the Command Line field, you will receive a “The File doesn’t exist in the specified location” error message (shown below).

This is because Dynamics attempts to validate the command line to make sure the application exists before it is launched and this validation does not handle parameters.

Note: You can also get this error if the file you are attempting to launch really does not exist. While writing this article I found a couple of support cases where this error was occurring on login because an external shortcut in the Startup folder was pointing to a non-existent file.

The resolution to this issue is to use a batch or command file with the full command line you need including the application path and the parameters and then pointing the Dynamics GP shortcut to this batch or command file.

The batch or command file is just a text file with the extension of the file changed to BAT or CMD.  The contents of the batch or command file can just be the path to the application followed by the parameters.

For example:

Notepad.exe “C:My DocumentsTest.txt”

Note: If any of the paths passed contain spaces you must wrap the path with double quotes (“).

If execute this shortcut you will notice that a DOS window will be left open until you close the application launched. To resolve this issue and “spawn” the application as a separate process we can use the Start command. The DOS window will open and then close immediately. So the command line becomes:

Start Notepad.exe “C:My DocumentsTest.txt”

This will work if the application path does not contain any spaces.  If the path contains spaces and you use double quotes (“) to wrap the application path, the Start command will interpret this as a window title and so ignore the application path and attempt the execute the next parameter. To prevent this from occurring we can add a window title to the syntax.

We can also use the @ command to prevent the Start command showing in the DOS window. So the final command line becomes:

@Start “Shortcut” Notepad.exe “C:My DocumentsTest.txt”

or more generically:

@Start “<Window Title>” “<Application Path>” <Parameter1> [<Parameter2>] ….

Hope you find this useful.


This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on

5 thoughts on “Creating External Shortcuts with Parameters

  1. Hi David,
    Just wondering if there is a way to edit the shortcuts you created in GP 10.0?
    When I moved a few files to different path in the network, shortcuts I created in GP became in valid. I could not figure out how to correct them. Any help is appreciated.


  2. Hi Sajith
    You should just be able to right click on them and select properties, then edit the path.
    Otherwise, just create them again.


Please post feedback or comments

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

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.