Developing for Dynamics GP

by David Musgrave (Perth, Australia) and Microsoft Dynamics GP Developer Support Team (Fargo, ND, USA)

Creating External Shortcuts with Parameters

Creating External Shortcuts with Parameters

  • Comments 3

David Meego - Click for blog homepageI 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).

Shortcut Error

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 Documents\Test.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 Documents\Test.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 Documents\Test.txt"

or more generically:

@Start "<Window Title>" "<Application Path>" <Parameter1> [<Parameter2>] ....

Hope you find this useful.


  • Posting from

  • 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.

  • Hi Sajith

    You should just be able to right click on them and select properties, then edit the path.

    Otherwise, just create them again.


Page 1 of 1 (3 items)
Comments Information


Please only post comments relating to the topic of this page.

If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.

Leave a Comment
  • Please add 8 and 5 and type the answer here:
  • Post