- 1 year ago
Error running forever.js on Windows - "'C:\Program' is not recognized as an internal or external command, operable program or batch file"
The error message "'C:\Program' is not recognized as an internal or external command, operable program, or batch file" often occurs when there is a space in the file path or directory name, and the command prompt interprets it incorrectly. To resolve this issue and run Forever.js on Windows, you can try the following steps:
Enclose the path in double quotes: When executing a command with a space in the file path, enclose the path in double quotes ("). For example:
swift"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\forever\bin\forever"
By enclosing the path in double quotes, the command prompt will correctly interpret it as a single path rather than treating each section separated by the space as separate arguments.
Use short file names: Alternatively, you can use the short file name convention to bypass the issue with spaces in the path. To find the short name of a directory, you can use the
dir /x
command. For example:bashdir /x "C:\Program Files"
This command will display the short name in the "DIR" output, such as "PROGRA~1" for "Program Files". You can use this short name in your command:
mathematicaC:\PROGRA~1\nodejs\node.exe C:\PROGRA~1\nodejs\node_modules\forever\bin\forever
By using one of these methods to handle the space in the file path, you should be able to run Forever.js on Windows without encountering the "'C:\Program' is not recognized" error.