locked
File type association and command line arguments RRS feed

  • Question

  • How can I get the command line argument in a JS Metro app?

    I have added some file type associations to the manifest file and now everytime I click on files of those types, my app is launched. However, I haven't found a way to access the command line arguments (I assume the file name is passed as a command line arg)


    Valentin Iliescu
    Friday, December 30, 2011 9:30 PM

Answers

  • This seems to be working:

    WinJS.Application.onmainwindowactivated = function (e) {
            if (e.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.file) {
                // the file object is in e.detail.files[0]
                doSomething(e.detail.files[0]);
            }
        }
    


    Valentin Iliescu
    • Marked as answer by Bob_Bao Monday, January 9, 2012 2:43 AM
    Monday, January 2, 2012 5:02 PM