How to set environment variables in windows shortcut?

I faced this problem when installed Inkscape (GNU GPL licensed SVG editor) with multiple language packs. Once I started the Inkscape for the first time, I got the UI in German language. Not nice, I wanted it in English. So, I started to look where can I switch the language, and surprisingly I didn’t find this option. Also there appeared to be no command-line switch for it. A brief search on the Web revealed that the Inkscape shows its UI in default system locale (which is German in my case), unless locale is overridden by the LANG environment variable. Tested from the command line – worked like a charm. So far so good, but I don’t like to start Inkscape from the command line each time.

Of course, the immediate solution is to create a batch script and start it via the shortcut. Separate batch script for that simple thing? Hmm…

Another possibility would be to set the environment variable for my entire user account using standard windows dialog. But this is not flexible since other programs may also react on LANG variable.

NetLicensing - Innovative License Management Solution

So, here is my final recipe, how to do it for a single program via the Windows shortcut without a separate batch script (on the example of Inkscape):

  • Create a new shortcut, enter the following command line:
C:\Windows\System32\cmd.exe /c "SET LANG=en && START /D ^"C:\Program Files (x86)\Inkscape^" inkscape.exe"

Drill-down:

Code fragment Explanation
C:\Windows\System32\cmd.exe start command line processor
/c instruct the command processor to execute provided string: “SET … inkscape.exe”
SET LANG=en set the environment variable, multiple SET commands can be chained using &&
&& execute another command if preceding SET has exited with the error code 0 (success)
START start a program in a new window
/D specifies working directory for the program
^” Just a quotation mark, ^ is an escape character in Windows, ensures that the quotation mark is included in the string, instead of closing it
C:\Program Files (x86)\Inkscape working directory for the program, can be taken from the original shortcut
inkscape.exe executable to start
  • Name the shortcut by the target program name (by default Windows proposes to call it “cmd”, since this is the first program this shortcut is pointing to)

  • Change the icon to the one from the target program executable

  • Change the “Run” mode to “minimized”

Since command processor is started first, without this option you will see a console window popping up shortly. Not critical, but a bit annoying. When started minimized, most likely you’ll not notice it at all.

Voila! My Inkscape is starting now with UI in English.