How do for example make it possible to pass an argument to the .exe file and read it in my XNA Game?


Enable Editor:

game.exe -devmode

Set Resolution:

game.exe -width 1280 -height 720

and in the game check the arguments before starting the game. I searched for this earlier and thought about it again but found nothing about it.


At the end of the day, XNA games are just regular .NET applications.

Read the docs on Main() and args.

You can also use System.Environment.GetCommandLineArgs (link).

  • \$\begingroup\$ Yes, I should've thought of that... Just been looking for XNA examples. :) \$\endgroup\$ – Deukalion Jan 5 '13 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.