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.


Note:
please have a look at the following link to find out  how to resolve common problems occur in creating PhoneGap projects.
http://simonmacdonald.blogspot.no/2012/11/getting-create-command-to-work-on.html
And also check android target is set to it's latest target version when running it Eclipse.