使用CasperJS作为便携式安装? [英] Using CasperJS as a Portable Installation?

查看:366
本文介绍了使用CasperJS作为便携式安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行不涉及设置PATH变量Windows中的一个可移植的方式CasperJS。
目前我已经得到了这部分地通过移动phantomjs与CasperJS目录到batchbin文件夹的全部内容一起可执行工作。我还编辑了批处理文件,使之使用当前目录,这是所有的文件都位于初始化casperJS。

I'm trying to run CasperJS in a portable way that doesn't involve setting the path variable in Windows. Currently I have gotten this to partially work by moving the phantomjs executable along with the entire contents of the CasperJS directory to the batchbin folder. I also edited the batch file to make it initialize casperJS using the current directory, which is where all the files are located.

下面是我用的所有文件目录:
http://i.imgur.com/ByTjU0s.png

Here is my directory with all the files: http://i.imgur.com/ByTjU0s.png

我casperjs.bat文件:

My casperjs.bat file:

    @ECHO OFF
    set CASPER_PATH=%~dp0
    set CASPER_BIN=%CASPER_PATH%bin\
    set ARGV=%*
    call phantomjs "%CASPER_BIN%bootstrap.js" --casper-path="%CASPER_PATH%" --cli %ARGV%

当我尝试执行它给我的文件:
http://i.imgur.com/0DK6B2g.png

When I try to execute the file it gives me: http://i.imgur.com/0DK6B2g.png

我想看看bootstrap.js文件,使之绕过版本检查,所以它不会给我这个错误,但我真的不知道我在做什么。

I tried to look at the bootstrap.js file to make it bypass the version check so it won't give me this error, but I'm not really sure what I'm doing.

我如何运行casperJS便携式不设置路径变量并且在一个单独的目录中的一切吗?

How can I run casperJS as a portable without setting the path variable and having everything in one single directory?

推荐答案

得到它的工作。
对于casperjs.bat文件,把

Got it to work. For the casperjs.bat file, put:

@ECHO OFF
set CASPER_PATH=%~dp0..
set CASPER_BIN=%CASPER_PATH%\bin\
set ARGV=%*
call phantomjs "%CASPER_BIN%bootstrap.js" --casper-path="%CASPER_PATH%" --cli %ARGV%

移动phantomjs.exe可执行文件的同一目录此批处理文件。应该正常工作。

Move the phantomjs.exe executable to the same directory as this batch file. Should work fine.

这篇关于使用CasperJS作为便携式安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆