Hi.
I've been looking into getting some PHP scripts to be usable as filters ... e.g.
dir | LineReverse
By using ASSOC and FTYPE at the command line to define what .php is and how it is executed, along with having the php.exe in PATH and .PHP in PATHEXT, the script executes, STDIN is always available, but STDIN becomes "blocking" and no output. (See
http://docs.php.net/manual/en/install.windows.commandline.php for the documentation I'm working from and currently updating).
But ...
dir | c:\php5\php.exe LineReverse.php
works fine.
I'm hoping someone who knows the way in which windows shells work can answer this.
The registry settings for .php and phpfile are ...
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.php]
@="phpfile"
"Content Type"="application/php"
and
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\phpfile
]
@="PHP script"
"EditFlags"=dword:00000000
"BrowserFlags"=dword:00000
008
"AlwaysShowExt"=""
[HKEY_CLASSES_ROOT\phpfile
\DefaultIc
on]
@="C:\\PHP5\\php-win.exe,0
"
[HKEY_CLASSES_ROOT\phpfile
\shell]
@="Open"
[HKEY_CLASSES_ROOT\phpfile
\shell\Ope
n]
@="&Open"
[HKEY_CLASSES_ROOT\phpfile
\shell\Ope
n\command]
@="\"C:\\PHP5\\PHP.EXE\" \"%1\" %*"
[HKEY_CLASSES_ROOT\phpfile
\shell\Ope
n\ddeexec]
[HKEY_CLASSES_ROOT\phpfile
\shell\Ope
n\ddeexec\
Applicatio
n]
@="PHP"
[HKEY_CLASSES_ROOT\phpfile
\shell\Ope
n\ddeexec\
Topic]
@="System"
I'm wondering if there are some additional options I can use here.
A daft example that works ...
dir Z:\*.txt | find /i ".txt" | php z:\filter.php | sort /r
outputs ...
txt.thgir 229,44 90:21 22/50/9002
txt.tfel 360,34 90:21 22/50/9002
txt.stsnoc 186,55 94:01 30/70/9002
txt.sruoloC tpmorP ISNA ediW 238,74 12:31 12/40/9002
txt.sruoloC tpmorP ISNA 238,74 01:31 12/40/9002
txt.selif 265,083 63:61 42/60/9002
txt.secnereffid CCC dnuoF 802 22:31 13/70/9002
txt.secnereffiD CCC 495,11 61:01 40/80/9002
txt.reknirhS 589,8 11:21 42/30/9002
txt.QAR 72 31:31 10/10/9002
txt.pleh_DV 929,01 11:11 31/50/9002
txt.nomeliF laitraP 910,33 81:80 80/40/9002
txt.lrep-llatsni-lcep 371,34 00:61 03/40/9002
txt.liavAsrohtuAkcehC 478,12 04:01 01/80/9002
txt.knaB tnerruC - tropeR yrammuS noitaulaV knaB tinU 068,16 13:51 92/50/9002
txt.knaB tnerruC - tropeR yrammuS noitaulaV knaB gnilretS 499,02 13:51 92/50/9002
txt.ini 423,92 20:11 12/40/9002
txt.ilc-php 223,92 15:41 61/40/9002
txt.gubed 914,01 31:90 71/80/9002
txt.gol.nomeliF 263,621 13:80 20/40/9002
txt.ger 86 72:41 91/30/9002
txt.fo spukcab ekaM 151 82:41 81/30/9002
txt.ffid.sj.p 593,2 20:11 11/60/9002
txt.edoc 086,22 74:80 12/40/9002
txt.ataD lacinhceT etuhCrewoP 804 43:51 02/70/9002
txt.94fo3 021,29 65:51 40/80/9002
txt.2lrep-llatsni-lcep 181,221 00:61 03/40/9002
txt.2d 369,4 24:51 21/60/9002
dir Z:\*.txt | find /i ".txt" | z:\filter | sort /r
executes (I can see this via Process Explorer), but nothing I have to CTRL+C to break the task.