Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create file with 0 bytes (length) ?

9 views
Skip to first unread message

Dennis Halver

unread,
Jul 6, 2009, 5:41:09 PM7/6/09
to
How can I create a file with 0 byte length?

Dennis

Pegasus

unread,
Jul 6, 2009, 6:12:50 PM7/6/09
to

"Dennis Halver" <ha...@persrec.com> wrote in message
news:4a526f74$0$32682$9b4e...@newsspool2.arcor-online.net...

> How can I create a file with 0 byte length?
>
> Dennis

Like this:
cd 2>Zero.txt


Todd Vargo

unread,
Jul 6, 2009, 6:13:55 PM7/6/09
to
Dennis Halver wrote:
> How can I create a file with 0 byte length?

The answer to this can be found in Prof. Timo Salmi's "Batch file
information and FAQs" which was posted just yesterday.

type nul>zerobyte.txt

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

Stubbo of Oz

unread,
Jul 6, 2009, 7:21:36 PM7/6/09
to
On 06 Jul 2009 21:41:09 GMT, ha...@persrec.com (Dennis Halver) wrote:

>How can I create a file with 0 byte length?
>

Open Notepad (or other text editor).

Don't enter anything then save it as an empty file

--
----------------
Stubbo of Oz
----------------

Ted Davis

unread,
Jul 6, 2009, 8:30:15 PM7/6/09
to
On Mon, 06 Jul 2009 21:41:09 +0000, Dennis Halver wrote:

> How can I create a file with 0 byte length?

There are several ways - OS specific ways, but

type nul > file

seems to work in all of them.

--

T.E.D. (tda...@mst.edu)

Tim Meddick

unread,
Jul 6, 2009, 9:12:50 PM7/6/09
to
To create a file with length of 0 [zero] bytes in length type :

echo. > TEST.TXT


...at the 'Command Prompt' (any dos version)

Then type :

edit.com /79 TEST.TXT

and delete the space and the two odd characters.

Save the file and exit EDIT.COM


Alternatively, use any other binary text editor do delete the CR+LF
end-of-line (return) characters to make the file 0 [zero] bytes.

==

Cheers, Tim Meddick, Peckham, London. :-)


"Dennis Halver" <ha...@persrec.com> wrote in message
news:4a526f74$0$32682$9b4e...@newsspool2.arcor-online.net...

01MDM

unread,
Jul 7, 2009, 1:58:50 AM7/7/09
to
On 7 июл, 01:41, h...@persrec.com (Dennis Halver) wrote:
> How can I create a file with 0 byte length?
>
> Dennis

cd.>Zero.txt

Batchman

unread,
Jul 7, 2009, 2:47:47 AM7/7/09
to
Hi Dennis,

On Mon, 06 Jul 2009 21:41:09 +0000, Dennis Halver wrote:

> How can I create a file with 0 byte length?
>
> Dennis

One technique is to use REM > Zero.Bat, another is ECHO.> Zero.Bat.

You may find that some methods work with some command prompts (Dos) and
not with others.

Batcher

Pegasus

unread,
Jul 7, 2009, 3:13:04 AM7/7/09
to

"Batchman" <batc...@fastmail.fm> wrote in message
news:pan.2009.07.07....@fastmail.fm...

Among the many replies in this thread, this one stands out because neither
of the two suggested methods will generate a zero-byte file.


charles

unread,
Jul 7, 2009, 9:12:40 AM7/7/09
to
On 06 Jul 2009 21:41:09 GMT, ha...@persrec.com (Dennis Halver) wrote:

>How can I create a file with 0 byte length?
>
>Dennis

type NUL >mtfile.txt

01MDM

unread,
Jul 7, 2009, 9:30:32 AM7/7/09
to
On 7 июл, 17:12, charles <some...@somewhere.invalid> wrote:

> On 06 Jul 2009 21:41:09 GMT, h...@persrec.com (Dennis Halver) wrote:
>
> >How can I create a file with 0 byte length?
>
> >Dennis
>
> type NUL >mtfile.txt

Hm, my version is the shortest: cd.>file - only 4 characters

foxidrive

unread,
Jul 8, 2009, 12:18:24 AM7/8/09
to
On Tue, 7 Jul 2009 06:30:32 -0700 (PDT), 01MDM <001.d...@gmail.com>
wrote:

.>file.txt

Only 1 character. :)

foxidrive

unread,
Jul 8, 2009, 12:27:29 AM7/8/09
to
On Mon, 06 Jul 2009 19:30:15 -0500, Ted Davis <tda...@mst.edu> wrote:

>On Mon, 06 Jul 2009 21:41:09 +0000, Dennis Halver wrote:
>
>> How can I create a file with 0 byte length?
>
>There are several ways - OS specific ways, but
>
> type nul > file
>
>seems to work in all of them.

This does too - tested in XP and MSDOS V6.22 at least.

rem.>file

01MDM

unread,
Jul 8, 2009, 1:33:07 AM7/8/09
to
On 8 июл, 08:18, foxidrive <got...@woohoo.invalid> wrote:
> On Tue, 7 Jul 2009 06:30:32 -0700 (PDT), 01MDM <001.dmi...@gmail.com>

> wrote:
>
> >On 7 ???, 17:12, charles <some...@somewhere.invalid> wrote:
> >> On 06 Jul 2009 21:41:09 GMT, h...@persrec.com (Dennis Halver) wrote:
>
> >> >How can I create a file with 0 byte length?
>
> >> >Dennis
>
> >> type NUL >mtfile.txt
>
> >Hm, my version is the shortest: cd.>file - only 4 characters
>
>  .>file.txt
>
> Only 1 character.  :)

Only 1 character. :)

Only _2_ characters, and error in host :( Not a nice way :)

foxidrive

unread,
Jul 8, 2009, 10:44:23 AM7/8/09
to
On Tue, 7 Jul 2009 22:33:07 -0700 (PDT), 01MDM <001.d...@gmail.com>
wrote:

>On 8 ???, 08:18, foxidrive <got...@woohoo.invalid> wrote:
>> On Tue, 7 Jul 2009 06:30:32 -0700 (PDT), 01MDM <001.dmi...@gmail.com>
>> wrote:
>>
>> >On 7 ???, 17:12, charles <some...@somewhere.invalid> wrote:
>> >> On 06 Jul 2009 21:41:09 GMT, h...@persrec.com (Dennis Halver) wrote:
>>
>> >> >How can I create a file with 0 byte length?
>>
>> >> >Dennis
>>
>> >> type NUL >mtfile.txt
>>
>> >Hm, my version is the shortest: cd.>file - only 4 characters
>>
>> �.>file.txt
>>
>> Only 1 character. �:)
>
>

>Only _2_ characters,

No, only 1 character. The others have to be there. :)

>and error in host :( Not a nice way :)

That wasn't part of the discussion. *grins*

01MDM

unread,
Jul 8, 2009, 11:07:04 AM7/8/09
to
On 8 июл, 18:44, foxidrive <got...@woohoo.invalid> wrote:
> On Tue, 7 Jul 2009 22:33:07 -0700 (PDT), 01MDM <001.dmi...@gmail.com>

:)

Dr J R Stockton

unread,
Jul 8, 2009, 9:02:54 AM7/8/09
to
In comp.os.msdos.misc message <4a526f74$0$32682$9b4e...@newsspool2.arco
r-online.net>, Mon, 6 Jul 2009 21:41:09, Dennis Halver
<ha...@persrec.com> posted:

>How can I create a file with 0 byte length?

I use

copy /y nul TRY.LOG > nul

in XP (sp3) CMD.EXE prompt; it AFAIR works at least in all earlier
systems; it also updates an existing TRY.LOG.

I use the sero-length file as an economical way of recording when
TRY,BAT was last run, surviving over re-boot; that is used in TRY.BAT so
that, in it, HUNT selects all *.htm files created or changed since
TRY.BAT was previously run.

A copy of TRY.BAT is in the Web directory below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)

Zaphod Beeblebrox

unread,
Jul 8, 2009, 2:00:04 PM7/8/09
to

"T Lavedas" <tglb...@cox.net> wrote in message
news:1cf74c95-922f-45b6...@t21g2000yqi.googlegroups.com...
>
> It appears the OP multi-posted and this same topic is covered in
> great
> detail over in alt.msdos.batch.nt,
>
Actually, he (yet again) crossposted and silently set followups to
AMBNT, and somewhere along the line the followup group got broken /
ignoted so that (yet again) the conversation got fragmented among the
various groups.

OP, if you are out there and reading this message, please do us the
courtesy of allowing the multipost to do what it was intended to do,
or at the very least indicate in the original post that you've set
followups to a specific group.

--
Zaphod

No matter where you go, there you are!


0 new messages