How to have Phantomjs execute a js file on Windows

10,795

Solution 1

Open the command window - this can be done by holding SHIFT + Right mouse click and there is a choice of Open command window here...

From the command line you can then invoke the phantomjs.exe

  $ path/to/phantomjs.exe path/to/version.js

Solution 2

You can also create windows environment path variable

add path/to/phantomjs.exe as environment variable with name phantomjs

then From the command line you can then invoke the phantomjs

$ phantomjs path/to/version.js

Solution 3

A better answer (I think) is : Add the path to the folder containing phantomjs.exe, to the PATH environment variable :) on Windows.

Share:
10,795
Ricky
Author by

Ricky

Updated on June 13, 2022

Comments

  • Ricky
    Ricky almost 2 years

    I just executed phantomjs.exe and a command line window popup. How could I execute the .js files under ./examples/? If just enter the file name "version.js", I got the error message - "cannot find the variable: version".

    Thank you!

  • Artjom B.
    Artjom B. over 9 years
    It will not work adding the new environment variable phantomjs. You have to include path/to/phantomjs.exe into the PATH variable.