Thursday, August 1, 2013

Solution to "cscript is not recognized as an internal or external command, operable program or batch file" error.

I got this error when I tried to build a PhoneGap project. Apparently it's a matter with Windows Script Host (WSH). You may have to install it or enable it. To install, follow this link and to enable WSH, I found this link which provides a guideline. Steps of that solution is also listed below.

1) Click the Start menu and type "regedit" on the search box. This will launch the Windows Registry Editor program.

2) Navigate to the following Registry entry:

HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings

3) Select the "Enabled" entry in the right window pane. If this entry does not exist, right-click anywhere in the right window pane and select "New" followed by "DWORD Value." Name the value "Enabled."

4) Right-click the "Enabled" entry and click "Modify."

5) Change the number in the "Value" box to "1." This will re-enable WSH.

If WSH has been disabled for all users on your computer, use the same process except instead of using "HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings" go to the "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings" key.

Only problem is this still not resolve my issue. The thing is after enabling/ installing Windows Script Host,  you need to make sure that the path to cscript.exe is in your PATH environment variable.

please have a look at the following link to find out  how to resolve common problems occur in creating PhoneGap projects.
And also check android target is set to it's latest target version when running it Eclipse.


  1. Hi

    I followed your steps but doesnt see success getting same error could you please help me on this.

  2. Hi there, greetings!!

    Followed instructions but no success. I updated registry and environmental path according to your instructions, then when I tried to run a .bat file from the location (cd [location of .bat file] ENTER; create.bat [that's the name of the bat file in phonegap] I got this message:

    "Input Error: There is no script engine for file extension ".js".

    Please advise!!


    1. hope this helps.

    2. Hi Asanka,

      Thanks for responding :)

      The stackoverflow page was helpful, lots of advice; I tried re-associating .js with JSFILE using CMD.exe, but got "Access is denied" message. I'll keep looking through the two links you gave and let you know if I find something that works.

    3. Winhelponline addressed how to fix for Windows XP with instructions to download an XP fix file. I am running windows 8 though. I've given up on PhoneGap for the time being. What I'm trying to do now is build an html5 app in Android Studio. The below instructions seem simple enough for me :)

    4. when re-associating .js with JSFILE using CMD.exe, you have to run cmd as run as administrator. If that doesn't work for you. try Winhelponline's Vista fix. There is a high probability, it might work. And also I've to advice about trying with android studio, above link is pretty much outdated, Phonegap/Cordova has changed a lot after there 3.0 release.