Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #11751

Re: Trying to create a .bat file for windows using fwrite(

Message-ID <9005933.JCBKxZ4cMZ@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-11-07 01:29 +0100
Subject Re: Trying to create a .bat file for windows using fwrite(
Newsgroups comp.lang.php
References <1e3380fe-bfde-4659-9426-55ca933b050e@googlegroups.com>

Show all headers | View raw


scasti1@yahoo.com wrote:
^^^^^^^^^^^^^^^^^
Please fix.

> I can create the .bat file, but the resulting file does not have the same
> new line characters as another file that executes and looks the same
> except for this
> 
> the working file seems to have the type of newline characters
> you would see in a word document (select it and you see a little
> blank character area)

The newline character sequence in WinDOS is <CR><LF>.  It is therefore 
natural that .bat files for Windows require this character sequence as they 
are executed by a WinDOS program, COMMAND.COM or CMD.EXE.
 
> will using PHP_EOL solve my problem?

Only if it is PHP on Windows.
 
> both files end up being properly recognized by the system as
> batch files and both look the same in terms of content except for
> the new line (i created my new line by using /r/n
> Its not the same.

The proper escape sequence is "\r\n" (in double-quotes).


PointedEars 
-- 
When all you know is jQuery, every problem looks $(olvable).

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Trying to create a .bat file for windows using fwrite( scasti1@yahoo.com - 2013-11-06 16:07 -0800
  Re: Trying to create a .bat file for windows using fwrite( Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-07 01:29 +0100
  Re: Trying to create a .bat file for windows using fwrite( Richard Damon <Richard@Damon-Family.org> - 2013-11-06 23:49 -0500
  Re: Trying to create a .bat file for windows using fwrite( scasti1@yahoo.com - 2013-11-07 12:00 -0800

csiph-web