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 8758279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:30:13+00:00 2026-06-13T14:30:13+00:00

Here I am trying to check that if file cmd.bat exist in temp folder

  • 0

Here I am trying to check that if file cmd.bat exist in temp folder then doesn’t create new one, otherwise create a cmd.bat in temp folder. But having problem with temp folder path “%temp%\cmd.bat”, it is displaying error :

Timestamp: 10/31/2012 3:21:40 AM
Error: NS_ERROR_FILE_UNRECOGNIZED_PATH: Component returned failure code: 0x80520001                  (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]
Source File: chrome://myext/content/overlay.js
Line: 9           

My code :

        var chk_file = Components.classes["@mozilla.org/file/local;1"]
             .createInstance(Components.interfaces.nsILocalFile);

        chk_file.initWithPath("%temp%\cmd.bat");

        if ( chk_file.exists() == false ) {
            Components.utils.import("resource://gre/modules/FileUtils.jsm");

            var file = FileUtils.getFile("TmpD", ["cmd.bat"]);
            file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
        }
        else
        {
            alert("file already exists");
        }
  • 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-06-13T14:30:15+00:00Added an answer on June 13, 2026 at 2:30 pm

    initWithPath takes full system path only.

    Use this to go to temp and then try

    var environment = Components.classes["@mozilla.org/process/environment;1"]
                                .getService(Components.interfaces.nsIEnvironment);
    
    
    var path = environment.get("TEMP");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a cmd file that will install a .msi and then
I am trying to check for new orders in Magento and if they exist,
I'm trying to make a program that takes in one argument, a file, and
I have a txt file that has a change-log.I'm trying to display the new
New guy here so bear with me. Ive got a basic XSL file that
I'm trying to build a hello-world program here to check my android kit installation.
I have a problem here im trying to upload a file first time it
Here I am trying to implement the jQuery I have two main files one
I am trying to check if a file is an image before I upload
I'm trying to put a list of URLs into a csv file that I'm

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.