Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6057111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:27:08+00:00 2026-05-23T08:27:08+00:00

i have an addon that i want to use to start program already installed

  • 0

i have an addon that i want to use to start program already installed on my computer eg notepad.exe

The problem is that it seems firefox does not search the system PATH for the program ie

        file.initWithPath("c:\\windows\\system32\\notepad.exe");//works
    //file.initWithPath("notepad.exe");//does not work
        //file.initWithPath("%systemroot%\\notepad.exe");//does not work

Question:
Is there a way of making firefox look for programs in the system PATH?
Here is my complete function

autoStartNotepad:function()
{
    // create an nsILocalFile for the executable
    var file = Components.classes["@mozilla.org/file/local;1"]
         .createInstance(Components.interfaces.nsILocalFile);
    file.initWithPath("notepad.exe");//does not work
    //but file.initWithPath("c:\\windows\\system32\\notepad.exe");//works

    // create an nsIProcess
    var process = Components.classes["@mozilla.org/process/util;1"]
                        .createInstance(Components.interfaces.nsIProcess);
    process.init(file);

    // Run the process.
    // If first param is true, calling thread will be blocked until
    // called process terminates.
    // Second and third params are used to pass command-line arguments
    // to the process.
    var args = [];
    process.run(false, args, args.length);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:27:08+00:00Added an answer on May 23, 2026 at 8:27 am

    nsIProcess won’t do this, it only accepts full paths. You will need to take a look at environment variables yourself:

    var environment = Components.classes["@mozilla.org/process/environment;1"]
                                .getService(Components.interfaces.nsIEnvironment);
    var path = environment.get("PATH");
    var root = environment.get("SYSTEMROOT");
    

    You can either split up the PATH variable and check the various directories or use the value of the SYSTEMROOT variable.

    You could run cmd.exe /c notepad.exe but there you also need to locate cmd.exe first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a Selenium test using the Firefox Addon. Now, I want to
I have a simple addon that adds a button to toolbar. I want this
I have a Java project that needs a addon interface. I was thinking about
I have a C++ program that keeps generating data. I have a python class
I have an existing VS 2005 Std .NET Compact Framework application that I want
I want to use jQuery in an add on JS library that can be
I have wrote a simple client that use TcpClient in dotnet to communicate. In
I want to use TFS like a project repository; I have had a very
I have the NewRelic addon installed on my Heroku application and I'm attempting to
I'd like to create an addon for Firefox that would enable me to search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.