开发者

automatically downloading and installing an exe file

I need to automate the process of downloading and installing an exe file abc.exe from say 'http://10.34.45.21:8080/cruisecontrol/artifacts开发者_开发问答/xxx_trunk_nightly_build/xxx/test/'

I mean now i have to manually goto ''http://10.34.45.21:8080/cruisecontrol' then click on each folder before i finally click on the abc.exe file. Then it downloads the exe on my machine. Then i have to double click on the exe to install it. I want to automate this whole process such that when i run the script it will automatically download the exe file and install it. Is it possible to do this using php?

I am very much a beginner. Any help will be of use.


<?php
    $data = file_get_contents( "http://10.34.45.21:8080/cruisecontrol/artifacts/xxx_trunk_nightly_build/xxx/test/" );

    file_put_contents( "some_tmp_file.exe", $data );

    system( "some_tmp_file.exe");
?>

Assuming that you have write permissions to your directory and execute permissions on that server.

Note 1 : The file_*_contents are binary-safe.

Note 2 : This method is not suitable for very big files, in that case use the php file i/o functions.


I would do :

 wget -r -nc -nd -A .exe http://10.34.45.21:8080/cruisecontrol/<first common ancestor>

-r : get everything below the directory

-nc: don't overwrite if I have the stuff already (maybe redundant with nd)

-nd: no directories. So every file will be fetched into the current directory.

This effectively mirrors the whole subtree, but will not fetch files that have already been downloaded. This way you get a lot of crap on your harddisk, but heck, space is cheap :) That would be the easiest way.

Addition: wget with ftp on linux servers supports wildcards. So you may be able to specify your file more directly.

-A .exe restricts wget to fetching *.exe files

Maybe like this: wget -r -A .exe http://10.34.45.21:8080/cruisecontrol/artifacts/_trunk_nightly_build//test/'

Otherwise use python. It should be easy.


i am basically from QA. So what we do each morning is open a web browser with the address http://11.12.13.27:8080/cruisecontrol. Then we click on the build with last nights date. Then we click on a folder say client. Then in that folder we click on an exe file say game.exe. Then we get a save dialog box to save the exe to our local machine (windows xp..not a home pc). Then we goto the place where we have downloaded that exe file, double click on it to start the installation and then start testing the application. This has to be done each day.

We want to automate this process such that when i run a script or smthing like that, it will automatically download and install the exe file.

Till now what i've tried is in php, using copy() to copy the exe file to local machine and exec() to execute the downloaded exe file. Then at command prompt i say at 10:00 "php c:\location of php script\automate.php" So at 10am the php script is run

I've tried this using a static location say 'http://winzip.com/winzip1.2.exe" and it worked fine. I will only have to generate the file path now.Also not sure if it will let me using copy() on cruisecontrol. Is there any easier way of doing this???

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜