Batch file arguments multiple line

I have the following batch command to call phpcb and pass arguments...

phpcb --space-after-if --space-after-switch --space-after-while --space-before-start-angle-bracket --space-after-end-angle-bracket --one-true-brace-function-declaration --glue-amperscore --change-shell-comment-to-double-slashes-comment --indent-with-tab --force-large-php-code-tag --force-true-false-null-contant-lowercase --align-equal-statements --comment-rendering-style PEAR C:\Documents and Settings\User\My Documents\a.php > C:\Documents and Settings\User\My Documents\b.php


How do I spread it out like this.............

phpcb
--space-after-if
--space-after-switch
--space-after-while
--space-before-start-angle-bracket
--space-after-end-angle-bracket
--one-true-brace-function-declaration
--glue-amperscore
--change-shell-comment-to-double-slashes-comment
--indent-with-tab
--force-large-php-code-tag
--force-true-false-null-contant-lowercase
--align-equal-statements
--comment-rendering-style PEAR
C:\Documents and Settings\User\My Documents\a.php > 
C:\Documents and Settings\User\My Documents\b.php



It is muuuuuuuuuuuch easier to read in the batch file and extend. But I can't figure out how to do this???
imagine7xyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
About the only way I can think of is:

(Where "P" is short for parameter)
Set P1=--space-after-if
Set P2=--space-after-switch
Set P3=--space-after-while
Set P4=--space-before-start-angle-bracket
Set P5=--space-after-end-angle-bracket
Set P6=--one-true-brace-function-declaration
Set P7=--glue-amperscore
Set P8=--change-shell-comment-to-double-slashes-comment
Set P9=--indent-with-tab
Set P10=--force-large-php-code-tag
Set P11=--force-true-false-null-contant-lowercase
Set P12=--align-equal-statements
Set P13=--comment-rendering-style PEAR
Set File1=C:\Documents and Settings\User\My Documents\a.php
Set File2=C:\Documents and Settings\User\My Documents\b.php

phpcb %P1% %P2% %P3% %P4% %P5% %P6% %P7% %P8% %P9% %P10% %P11% %P12% %P13% "%File1%" > "%File2%"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill PrewIT / Software Engineering ConsultantCommented:
Try the following, adding a caret (after a space) at the end of the line should tell the command interpretter to ignore the line feed.  I think you may need the ">" on the last line, but you can try it the way you had it.

phpcb ^
--space-after-if ^
--space-after-switch ^
--space-after-while ^
--space-before-start-angle-bracket ^
--space-after-end-angle-bracket ^
--one-true-brace-function-declaration ^
--glue-amperscore ^
--change-shell-comment-to-double-slashes-comment ^
--indent-with-tab ^
--force-large-php-code-tag ^
--force-true-false-null-contant-lowercase ^
--align-equal-statements ^
--comment-rendering-style PEAR ^
C:\Documents and Settings\User\My Documents\a.php ^
> C:\Documents and Settings\User\My Documents\b.php

~bp
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
Interesting... that should work... nice.
0
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

t0t0Commented:
The other way of doing it is like this:

NOTE 1: I find it easier to just add or remove arguments at will without effecting the logic of the code.

NOTE 2: Do you need to enclose %source% and %destination% in double-quotes like this: "%source%" and "%destination%" due to them botrh having spaces in their paths?
 



@echo off
setlocal enabledelayedexpansion

set line=
set source=C:\Documents and Settings\User\My Documents\a.php
set destination=C:\Documents and Settings\User\My Documents\b.php

for %%a in (
   --space-after-if
   --space-after-switch
   --space-after-while
   --space-before-start-angle-bracket
   --space-after-end-angle-bracket
   --one-true-brace-function-declaration
   --glue-amperscore
   --change-shell-comment-to-double-slashes-comment
   --indent-with-tab
   --force-large-php-code-tag
   --force-true-false-null-contant-lowercase
   --align-equal-statements
   --comment-rendering-style
   PEAR
) do (
   set line=!line!
)

phpcb %line% %source% > %destination%
0
t0t0Commented:
Oops!! I didn't copy and paste the code correctly.... Here it is again:





The other way of doing it is like this:

NOTE 1: I find it easier to just add or remove arguments at will without effecting the logic of the code.

NOTE 2: Do you need to enclose %source% and %destination% in double-quotes like this: "%source%" and "%destination%" due to them botrh having spaces in their paths?
 



@echo off
setlocal enabledelayedexpansion

set line=
set source=C:\Documents and Settings\User\My Documents\a.php
set destination=C:\Documents and Settings\User\My Documents\b.php

for %%a in (
   --space-after-if
   --space-after-switch
   --space-after-while
   --space-before-start-angle-bracket
   --space-after-end-angle-bracket
   --one-true-brace-function-declaration
   --glue-amperscore
   --change-shell-comment-to-double-slashes-comment
   --indent-with-tab
   --force-large-php-code-tag
   --force-true-false-null-contant-lowercase
   --align-equal-statements
   --comment-rendering-style
   PEAR
) do (
   set line=!line! %%a
)

phpcb %line% %source% > %destination%





NOTE 3: Following DOS conventions, as state in NOTE 2, you may have to change the last line to:

   phpcb %line% "%source%" > "%destination%"

0
imagine7xyAuthor Commented:
phpcb ^
--space-after-if ^
--space-after-switch ^
--space-after-while ^
--space-before-start-angle-bracket ^
--space-after-end-angle-bracket ^
--one-true-brace-function-declaration ^
--glue-amperscore ^
--change-shell-comment-to-double-slashes-comment ^
--indent-with-tab ^
--force-large-php-code-tag ^
--force-true-false-null-contant-lowercase ^
--align-equal-statements ^
--comment-rendering-style PEAR ^
C:\Documents and Settings\User\My Documents\a.php ^
> C:\Documents and Settings\User\My Documents\b.php


THIS DOES NOT work -- complains about file handlers or something, spent an hour trying it. HOWEVER, other methods do work.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
The problem you're experiencing with the ^ marks is probably due to paths not being in quotes.  At least that's my guess.

It does work with simple commands, such as:
dir ^
/s ^
/od ^
/ad

and so there shouldn't be a problem with complex commands - unless there's a problem with the line to begin with.

You are redirecting output to b.php - but the file name contains spaces which redirection cannot cope with unless it's in quotes - mine works because I put the file path in quotes (though I neglected to clarify why until now).
0
t0t0Commented:
imagine7xy

Oddly enough, my code in comment ID 31087647 mentioned the need for double-quotes and I do believe my code works 100%. I find it strange my code was never acknowledged by you.

You couldn't get billprew's code to work and I suspect this is due largely because of the missing double-quotes.

I would have accepted a split decision however, to be out-chosen by the solution offered by leew is an insult to 'proper' DOS programming and to myself - but then, I wouldn't expect you to know that as it's evident, you know lttle or nothing whatsoever about 'programming' because if you did, you would have recognised my code is dynamic - not relying on fixed labels to represent command line arguments.

I hope you have the conscience to re-open this question and award the points fairly - even if this means dividing the points between multiple solutions.
0
imagine7xyAuthor Commented:
t0t0, sorry, about that, I'm new to EE.

leew:

I wish oh how I wish to much that the caret ^ example would work! Gosh, I have tried quoting the file paths many times, and originally (Before I even posted this) I had messed with the caret for hours!

However, it just doesn't work... I don't get it!

For instance, here is some code, in batch, that RUNS just FINE and DANDY...

tidy -config "C:\Documents and Settings\Strife\My Documents\tidy.cfg" %1 | php_beautifier -t -o %1

HOWEVER:

If I change it to...

tidy -config ^
"C:\Documents and Settings\Strife\My Documents\tidy.cfg" %1 | php_beautifier -t -o %1

The whole thing DOESN'T WORK anymore........

Thoughts please, I really wish I could get the caret to work!
0
imagine7xyAuthor Commented:
I should mention:

tidy -config "C:\Documents and Settings\Strife\My Documents\tidy.cfg" %1 ^
| php_beautifier -t -o %1

tidy -config ^
"C:\Documents and Settings\Strife\My Documents\tidy.cfg" %1 | php_beautifier -t ^
-o %1

These don't work either. The caret doesn't seem to work, it doesn't process the request the same...

I get an error which I'll post in 1 second.
0
imagine7xyAuthor Commented:
Alright, it turns out I was wrong about some thing:

NOT WORKING:
tidy -config ^
"C:\Documents and Settings\Strife\My Documents\tidy.cfg" %1 | php_beautifier -t -o new.php

WORKING:
tidy -config "C:\Documents and Settings\Strife\My Documents\tidy.cfg" ^
%1 | php_beautifier -t -o new.php

Any ideas why one works and the other doesn't? Do I need to escape the caret so it doesn't get passed along with -config as part of the parameter or something?
0
imagine7xyAuthor Commented:
Oh t0t0:

Just because I don't know windows shell commands doesn't mean I know "little to nothing about programming". I've sort of neglected learning it because I had no applications for using it until now. Honestly, I want to just switch to Linux soon and learn that shell.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
Well, t0t0, thanks for the insult...

Do you teach a course in "proper" DOS programming?  Can you direct me to one?

Considering that this isn't even "DOS" programming...

But coming from someone who doesn't understand the proper way to comment code, I'll try not to take it any more personally than I already have.

imagine7xy,
Can you put both in a batch file (with echo off disabled), run it, and post a screen shot or copy and paste of the entire process.  Knowing error messages might give a clue as to why one is a problem and the other is not.
0
Bill PrewIT / Software Engineering ConsultantCommented:
==> leew

I feel your pain...

~bp
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
billprew -

If we work this out and get your tip working, I have no problem with a reopen and split...

-Lee
0
imagine7xyAuthor Commented:
How do you reopen? I'll split it up.
0
t0t0Commented:
I did write a reply to this question last night but fell asleep at the keyboard before submitting it. Of course, with one hand still on the keyboard and the mouse in the other, goodness only knows what happened to all those windows I had open....I woke this morning to find I'd lost the lot.


Anyway, leew.

>> "Do you teach a course in "proper" DOS programming?"

Now, there's a thought... Perhaps some of us on EE could do with a good teaching...

>> "Considering that this isn't even "DOS" programming..."

What would you call it then?

>> "But coming from someone who doesn't understand the proper way to comment code..."

Now I know you're kidding. Besides, looking at my code in this thread, just exactly how commenting do you really feel is necessary? Would you agree, about the same amount of commenting included in your own code?


billprew

>> "I feel your pain..."

Yawn.... I just wonder how much arse-licking is required to earn respect in EE.

If so say experts in this zone can't take criticism for their (sometimes) crappy code then that's their problem, not mine. When I get it wrong, I take the flack and accept responsibility for my own crappy code however, I'm sure that doesn't happen often. Be the first to show me some crappy code I've written and I'll put both hands up and say you're right!


imagine7xy

In the reply that I did not post late last night, I described how you were wrong in stating the following code does not work:

tidy -config ^
"C:\Documents and Settings\Strife\My Documents\tidy.cfg" %1 | php_beautifier -t -o %1

I described how DOS parses command lines prior to actually executing them. I also suggested omiting the '@echo off' line at the begining of your batch file because DOS displays each line of code on the screen prior to executing it. Therefore, if you were to examine the displayed parsed command line you would realise the ceret does infact work.

If there are other reasons why this code does not work (including Leew's code above) then you should look to see whether the problem is at your end or possibly with your command line options.

As for splitting the points, I've gone past the point of caring. Do as you please however, my concern lies in the fact that should someone stumble on this problem in the future, by not crediting my code they could overlook my solution. If it were purely for personal gain then I could probably accept leew's and billprew's belly-aching over my objection.


Finally, leew,

>> "Well, t0t0, thanks for the insult..."

Not an insult mate... Compare our codes and be honest.

I suspect your problem is you rushed so much in an attempt to be the first to answer this question hoping to bag some points you gave little or no consideration to the structure or design of your code whatsoever.


In general

I must admit, when I wrote my code, I wasn't aware I could spread the FOR command over several lines as shown in my code until I tried and tested it. I have never seen this done before anywhere and I suspect this is a first for EE. This is another reason why I feel my solution should not be swept under the carpet. Naturally, a 'real' programmer would enthusiastically agree!
0
t0t0Commented:
If it pleases you to include ALL your options as a single list then please look at the following simple code (which hopefully, DOES NOT require commenting - even to a non-programmer like yourself)!


@echo off
setlocal enabledelayedexpansion
set line=

for %%a in (
   --space-after-if
   --space-after-switch
   --space-after-while
   --space-before-start-angle-bracket
   --space-after-end-angle-bracket
   --one-true-brace-function-declaration
   --glue-amperscore
   --change-shell-comment-to-double-slashes-comment
   --indent-with-tab
   --force-large-php-code-tag
   --force-true-false-null-contant-lowercase
   --align-equal-statements
   --comment-rendering-style
   PEAR
   "C:\Documents and Settings\User\My Documents\a.php" ^>
   "C:\Documents and Settings\User\My Documents\b.php"
) do (
   set line=!line! %%a
)

phpcb %line%
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
>> What would you call it then?
BATCH PROGRAMMING

>> Now I know you're kidding. Besides, looking at my code in this
>> thread, just exactly how commenting do you really feel is
>> necessary? Would you agree, about the same amount of
>> commenting included in your own code?

I wasn't referring to a lack of commenting... I was referring to your improper use of :: as a comment marker in prior questions.  If you're going to claim "to be out-chosen by the solution offered by leew is an insult to 'proper' DOS programming and to myself", Implying that anything I do is "improper" and that YOU always code properly, I'm going to verify you know proper BATCH programming... and you don't.  And how else should I take that, other than as an insult?

>> I suspect your problem is you rushed so much in an attempt
>> to be the first to answer this question hoping to bag some
>> points you gave little or no consideration to the structure or
>> design of your code whatsoever.

Ah, I see, since you came up with a creative solution, I don't know what I'm doing and simply rushing through it... got ya... How is that an not insult - you even "must admit, when I wrote my code, I wasn't aware I could spread the FOR command over several lines as shown in my code until I tried and tested it."

I enthusiastically agree that billprew's code is a useful, unexpected, and a creative way of doing it.  And I'd like to see what the problems were.  His code provides a way that, in theory, should break up long lines of code in a way similar to my understanding of _ in VB.  The for command you posted may even work, but it's not nearly as useful in my opinion.

In general, there's nothing wrong with the way I did it... it's not creative, it's not new, but it works.  If you don't want to be insulting, don't essentially call yourself insulted by my code be selected as the answer and yours not.
0
Bill PrewIT / Software Engineering ConsultantCommented:
==> imagine7xy

==> THIS DOES NOT work -- complains about file handlers or something, spent an hour trying it.
==> HOWEVER, other methods do work.

The below code worked for me.  Make sure when you cut and paste this there are no trailing spaces after the caret characters at the end of each line.

However, when I tried to quote the input and output path names as follows I did have a problem, I suspect as you did.

phpcb ^
--space-after-if ^
--space-after-switch ^
--space-after-while ^
--space-before-start-angle-bracket ^
--space-after-end-angle-bracket ^
--one-true-brace-function-declaration ^
--glue-amperscore ^
--change-shell-comment-to-double-slashes-comment ^
--indent-with-tab ^
--force-large-php-code-tag ^
--force-true-false-null-contant-lowercase ^
--align-equal-statements ^
--comment-rendering-style PEAR ^
"c:\temp\EE25932402\in.txt" > ^
"c:\temp\EE25932402\out.txt"

One way to work around this that seems to work fine is:

type "c:\temp\EE25932402\in.txt" | ^
phpcb ^
--space-after-if ^
--space-after-switch ^
--space-after-while ^
--space-before-start-angle-bracket ^
--space-after-end-angle-bracket ^
--one-true-brace-function-declaration ^
--glue-amperscore ^
--change-shell-comment-to-double-slashes-comment ^
--indent-with-tab ^
--force-large-php-code-tag ^
--force-true-false-null-contant-lowercase ^
--align-equal-statements ^
--comment-rendering-style PEAR > ^
"c:\temp\EE25932402\out.txt"

Since phpcb reads from STDIN we can let it get it's input that way rather than on the command line, and it seemed to work.  This feels like a subtle "bug" in phpcb but it could be something in dos too.  Putting it all on one long line does work, even with the quoted input and output paths, so it seems to be a combination of phpcb and the line splitting that it doesn't like.

~bp
0
t0t0Commented:
Wrong! Look up the definition of a 'programming language'. You'll notice a programming language by definition contains the means to process commands sequentially, by iteration and by selection.

Let's look at some simple examples:

   Sequential processing - Well, that's just one instruction (or command or function) after another.

   Iteration - FOR..IN..DO and, :loop..GOTO loop

   Selection - IF..ELSE..

So, having agreed it's a 'programming language' (of some sorts) you seem to have a problem calling it 'DOS programming language'.

Now look up the definition of 'batch processing'. This is where several commands are executed one after another as a batch process.

Are you suggesting then that what I call 'DOS programming' is in fact a hybrid of 'batch processing' and 'a programming language' hence 'batch programming'?

In my view, it's either 'batch' or 'program'... I could be wrong though however, the presence of the three main elements of any programming langauge lead me to think of 'batch file programming' as 'DOS programming'

Or may be it's named 'batch programming' because we normally associate it with writing 'batch' files.

Why not 'CMD programming' then?

Or indeed 'batch scripting'?

Infact, what is the real definition of 'scripting' as opposed to 'programming'?


>>(my) "improper use of :: as a comment marker..."?

Is there an 'improper' use of '::' comment markers? Please clarifty what you are refering to. If there is something you feel I need to know then please let me.

I did NOT infer "anything (you) do is 'improper'", nor did I infer "(I) always code properly". These are your interpretations. My comments relate to your code in this thread. Admitedly, my comments were harsh but I'll ask you again (and this time, think like a 'programmer' when answering) look at our codes and compare them. In fact, if you look at my last code (ID 31183120) you'll realise I've arrived as close as I can to making my point.

Having said that though, assigning each individual command line parameter to a variable works equally well - but it's not truly dynamic. For example, suppose the asker wants to slip an additional command line option in say, between P3 and P4. Would he then have to rename all variables after P3 so that they appear sequence named? (I know he doesn't really HAVE to in order for the code to work and perhaps I'm being petty) but I feel there are constructs (such as FOR) that are designed to handle situation like this one.

Nevertheless, using multiple assignments and assembling them is just as valid but without the additional structure available in DOS.

Don't take it as an insult. Take it as criticism (constructive, if possible). And if you've learned something from it then thank me instead of biting my back. I'm not saying I know DOS or programming better than you do. I'm saying there is a difference in our approach to this question. Yours is a 'batch process', mine is a 'DOS program'.

Yes, I do admit to not knowing beforehand I could split FOR over several lines as shown in my code because I have never done that before. Have you? DId you know this? (I suspect NOT due to your comment later on "may even work").

During the design phase of my code, I layed out the data and commands to suit the logic of what I was attempting to do. On a hunch, I tried the code and it worked. The emphasis here is that I modelled the code on a design - meaning I had spent some time actually thinking about program structure, data structure and program design - just as a good programmer would.

>>"I enthusiastically agree that billprew's code is a useful, unexpected, and a creative way of doing it"

I don't - and there are many reasons why.

FIrstly, let me confirm billprew's code works 100%. Try it yourself. Copy and paste his code into Notepad and run it with ECHO ON. Look particularly at the parsed command echo'd to the screen. Of course it works - there's no need to throw in the phrase "in theory"... This just suggests either (a) you don't know, (b) you didn't test his code or (c) you tested his code but you still don't know.

Furthermore, it's not 'creative'. Using the ceret to break up lines is a long established and known fact.

Now, for a few of those reasons,

   (1) it introduces additional characters to the data-field.
   (2) it's easy to omit one or some cerets.
   (3) what happens if you inadvertantly type 2 cerets instead of just 1?
   (4) there appears to be some uncertainty with ceret behainvg as escape characters near '<', '>', '|' etc..
   (5) how would you handle a line that naturally ends with a ceret?
   (6) should there be a space seperating the line from the ceret?
   (7) to answer (6), placing a space infront of the ceret introduces a space in the resultant data


>>"The for command you posted may even work"

Who's insulting who? At least have the courtesy of testing my code before commenting on it - surely I deserve that much at least.

Of course it works.

>>"but it's not nearly as useful in my opinion"

Okay, let's look at a single undisputable fact.

(1) Your code takes each line of data and mucks about with it by tacking a '"set P...=" in front of it.

(2) billprew's code does the same but instead, tacks a ceret onto the end of aech data line (and by doing so, adds an extra space to the end of each data item).

(3) My code merely wraps the data in a FOR command leaving it otherwise untouched. This means it is not so prone to errors.

Furthemore, unlike your code, additional data can be inserted into the data field of my code at will WITHOUT having to make any other changes to the program in order for it to continue working.

So, do you still hold your opinion?

Oh, and regarding your last sentence - would you not agree at least a split in points were in order?....

Or, should the points be awarded soley to you because yours is the first working code that provides a solution to this question?
0
t0t0Commented:
Okay, I take back what I just said, billprew's code works only 98% - not 100% as stated above.

This seems to indicate a serious problem... It's evident from this the ceret method does not provide a reliable solution
0
t0t0Commented:
billprew, it's not a bug with phpcb... it's a DOS issue.

Compare the results from this simple test...

THIS WORKS FINE

>echo a^
More? b^
More? c
abc

>_



THIS DOES NOT

>echo a^
More? "b"^
a"b"^

>_

Notice '"b"^' didn't prompt me for the 'c'.
0
Bill PrewIT / Software Engineering ConsultantCommented:
==> imagine7xy

Where are you on this, do you have what you need yet, or still looking for other ideas?

~bp
0
imagine7xyAuthor Commented:
solve
0
imagine7xyAuthor Commented:
Alright I've spread out the points evenly.

>>t0t0: If it pleases you to include ALL your options as a single list then please look at the following simple >>code (which hopefully, DOES NOT require commenting - even to a non-programmer like yourself)!

Wrong again, I am a programmer, its my job.
0
t0t0Commented:
imagine7xy

The comment in brackets were not aimed at you. If you had read the previous post, you would understand (just prior to the label: billprew). It was meant as sarcasm.

Anyway, the points distribution is an improvement (although, not perfect from my point of view( however, I see you're getting the hang of this.

Thank you for your cooperation and apologies for being dragged through this pile of shite I have had to put up with.
0
imagine7xyAuthor Commented:
About the caret -- this is a problem that is all over the web. Sometimes the caret works, and in some situations it doesn't. ie http://ubuntuforums.org/showthread.php?t=630254 In my experience so far, the caret will *NOT* work as a line continuation in the middle of arguments that are to be passed. For instance, for phpcb, "-config (file location)" is all one argument, if you use:

Works:
-config (file location) ^
[...]

Error:
-config ^
(file location) [...]

Thus, this is why I asked this question here. I've long known about the caret as the batch line continuation as it is the de facto method but I was hoping you could shed some light on this issue in this EE batch thread instead of me scouring the web.

Of course, the other suggestions I know about already, since I know about the MS-DOS language syntax and how to set variables already.

I was hoping batch would allow some consistent line continuation character however what we have encountered here is a bug, that the line feeds or carriage returns are getting passed along with the argument IF you use it in the middle of an argument, you CAN however use it BETWEEN arguments.
0
t0t0Commented:
leew

If there is more you feel you'd like to add in response to my comment ID 31192644 in particular, your reference to my 'improper' use of my '::' comment markers then please do so, so that we can finally move on.
0
imagine7xyAuthor Commented:
Okay - this will shed some light on the issue. HE eventually finds a solution -- more of a "hack job" to add a space before arguments because - lets face it, the caret behaves erratically unpredictable. Which is why I posted this thread.

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_22848528.html
0
imagine7xyAuthor Commented:
Alright, here is some sample output ---------->

Not working:
type %1 | tidy -config ^
"C:\Documents and Settings\Strife\My Documents\tidy.cfg" -f > formatted.php
Error: The process tried to write to a nonexistent pipe.

Working:
type %1 | tidy  -config ^
 "C:\Documents and Settings\Strife\My Documents\tidy.cfg" -f  > formatted.php

Working:
type %1 | tidy   -config ^
tidy.cfg  -f  > formatted.php

(Yes, there is a space, right before the double quote, for some reason this is always necessary with ^.)
0
imagine7xyAuthor Commented:
In about example. because there is NO edit for EE...

Working:
type %1 | tidy  -config ^
(space)"C:\Documents and Settings\Strife\My Documents\tidy.cfg" -f  > formatted.php

Without space, before double quote, NO GO.
0
t0t0Commented:
that just goes to show how flaky billprew's solution is. i have never had to use this method of line-continuation therefore, I was not aware of this problem. It is because of this I was led to believe it worked in all circumstances.

I did do some minor tests (during this thread) though and I commented on some of the shortfalls of it's use. I admit to not knowing more about this problem and I am delighted to to discover this is an unreliable method.

Looks like prew picked up a few undeserved points...  In my opinion, so did leew (only because he caused me to spend more time on this than I really needed to).

Btw, which solution did you use in the end. You won't offend me if you say leew's as I've gone past caring now. It's been a long day.
0
imagine7xyAuthor Commented:
Works
type %1^
(space)| tidy -config^
 (space)"C:\Documents and Settings\Strife\My Documents\tidy.cfg" >^
 (space)formatted.php

Returns Error
type %1(space)^
 | tidy -config(space)^
 "C:\Documents and  Settings\Strife\My Documents\tidy.cfg" >(space)^
 formatted.php
0
imagine7xyAuthor Commented:
t0t0: in the end I used none of your solutions, instead I avoided setting all the options via the batch file, opting for the -config file argument.
0
Bill PrewIT / Software Engineering ConsultantCommented:
==> imagine7xy

Thanks for the feedback and discussion.  I agree, and have experienced, that getting the line continuation to work properly in BAT files takes a bit of trial and error.  My understanding has been that you have two choices, you can either end a line with a space followed by a caret, or you can end a line with a caret and then begin the next line with a space.  I often prefer the first of these for readability, but the latter seems to work better in your case, maybe that's a more reliable approach.  For example, this works okay for me:

phpcb^
 --space-after-if^
 --space-after-switch^
 --space-after-while^
 --space-before-start-angle-bracket^
 --space-after-end-angle-bracket^
 --one-true-brace-function-declaration^
 --glue-amperscore^
 --change-shell-comment-to-double-slashes-comment^
 --indent-with-tab^
 --force-large-php-code-tag^
 --force-true-false-null-contant-lowercase^
 --align-equal-statements^
 --comment-rendering-style PEAR^
 "c:\temp\EE25932402\in.txt"^
 >"c:\temp\EE25932402\out.txt"

If it were me (and you may already be doing this) I'd wrap the above in a BAT file of it's own, say myphpcb.bat, and then run it passing in the input and output filenames as parms.  I suspect that's where you are, but not sure.

AAR, hope my comments were at least somewhat helpful, I enjoyed your exchanges on the topic here.

~bp
0
Bill PrewIT / Software Engineering ConsultantCommented:
==> imagine7xy

Interesting on the -config, one of the first things I went looking for was an option to pull the config from a seperate file, but I didn't see it documented on the website.  Where did you come across that capability, and what was the syntax (for future reference)?

~bp
0
imagine7xyAuthor Commented:
Oh, yes, I ended up switching my php code formatter to PHP_Beautifier, part of PEAR's library. For HTML, I use Tidy, but I'm having issues with that as well, replacing PHP < > signs as HTML entities inside HTML attributes and there doesn't seem to be any options to turn it off.
0
Bill PrewIT / Software Engineering ConsultantCommented:
==> imagine7xy

==> Oh, yes, I ended up switching my php code formatter to PHP_Beautifier, part of PEAR's library.

Ah, that makes sense now, thanks.

~bp
0
t0t0Commented:
>>"in the end I used none of your solutions, instead I avoided setting all the options via the batch file, opting for the -config file argument.

In that case. I have no objection to you re-opening this question once more and this time close it without awarding points. And at the same time, indicate you found the solution yourself.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.