For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2006 > comand line file repository









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author comand line file repository
Jean Pierre Daviau

2006-03-12, 9:55 pm

Hi to every one,

Is there a way I could store my files in a directory where they could be
fetch by php -f command line anywhere in the explorer? Has this done with
the includes for example.

Exemple:
c:/> php -f myfile.php
c:/../desktop> php -f myfile.php
etc.

--
Thanks for your attention.

Jean Pierre Daviau
--
Easyphp1.8
Apache1.3.24
DEVC++, borland 5.5
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
http://www.jeanpierredaviau.com


J2be

2006-03-14, 3:55 am

> Is there a way I could store my files in a directory where they could be
> fetch by php -f command line anywhere in the explorer? Has this done
> with the includes for example.


explorer ? Please explain what do you mean.

> Exemple:
> c:/> php -f myfile.php
> c:/../desktop> php -f myfile.php
> etc.
>


to execute the php binary from anywhere you've to add the php folder in the
PATH environment variable

Please be more specific if that's not what you are searching for.

--
Leonardo Armando Iarrusso - J2Be
www: http://www.J2be.com - e-mail: info[at]J2Be.com



d

2006-03-15, 6:56 pm

"Jean Pierre Daviau" <Once@WasEno.ugh> wrote in message
news:_N3Rf.2503$wy.242433@weber.videotron.net...
> Hi to every one,
>
> Is there a way I could store my files in a directory where they could be
> fetch by php -f command line anywhere in the explorer? Has this done
> with the includes for example.
>
> Exemple:
> c:/> php -f myfile.php
> c:/../desktop> php -f myfile.php
> etc.


I've done this myself. It's quite straight-forward:

1. Create a batch file that will be used to run the PHP scripts from the
command line:

@echo off
c:\apache\php\php.exe -c c:\apache\php.ini -f %1

Save it in your PHP directory, and call it run_php_cli.bat or something.

2. In explorer, right-click a .php file and select "Open With > Choose
program", select your batch file from step #1, and select "Always use the
selected program to open this kind of file", and click OK. Alternatively,
you could call your CLI PHP scripts, say, .xphp, to differentiate them from
server-side scripts, and then use that extension instead to assign the
run_php_cli.bat.

Now, wherever you are, running

whatever.php (or whatever.xphp, depending on which extension you chose in
#2)

will work as expected.

Hope that helps!

dave

> --
> Thanks for your attention.
>
> Jean Pierre Daviau
> --
> Easyphp1.8
> Apache1.3.24
> DEVC++, borland 5.5
> windows Xp
> asus p4 s533/333/133
> Intel(R) Celeron (R) CPU 2.00 GHz
> http://www.jeanpierredaviau.com
>



Jean Pierre Daviau

2006-03-15, 6:56 pm

Thanks,

Waiting for the answer I tried the following:
In my cmd shortcut Target text input:
%SystemRoot%\system32\cmd.exe /k doskey /macrofile=F:\jpd\macros.ini
-------
there is a lot of things in macro.ini and:
myphp=php -check -f G://classes/$1 $2 $3 $4

$1 $2 $3 $4 being for the parameters
------

I can call all my classes that way:
>myphp myFile.php para1 true rememberMe ...





"d" <d@example.com> a écrit dans le message de news:
_uVRf.36316$wl.4742@text.news.blueyonder.co.uk...
> "Jean Pierre Daviau" <Once@WasEno.ugh> wrote in message
> news:_N3Rf.2503$wy.242433@weber.videotron.net...
>
> I've done this myself. It's quite straight-forward:
>
> 1. Create a batch file that will be used to run the PHP scripts from the
> command line:
>
> @echo off
> c:\apache\php\php.exe -c c:\apache\php.ini -f %1
>
> Save it in your PHP directory, and call it run_php_cli.bat or something.
>
> 2. In explorer, right-click a .php file and select "Open With > Choose
> program", select your batch file from step #1, and select "Always use the
> selected program to open this kind of file", and click OK. Alternatively,
> you could call your CLI PHP scripts, say, .xphp, to differentiate them
> from server-side scripts, and then use that extension instead to assign
> the run_php_cli.bat.
>
> Now, wherever you are, running
>
> whatever.php (or whatever.xphp, depending on which extension you chose in
> #2)
>
> will work as expected.
>
> Hope that helps!
>
> dave
>
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com