Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: ^Z in batch file  (Read 10813 times)

0 Members and 1 Guest are viewing this topic.

UNLISTED

  • Guest
^Z in batch file
« on: November 25, 2004, 06:58:49 PM »
my problem:

if you type at the prompt:

copy con <'filename'>
<'command'> <f6>

if writes a file with that command.
BUT
i want to make a batch file that can do that..
FOR EXAMPLE:
say i want to make a simple batch file that will create another batchfile on the desktop with the 'dir' command.
if i was at the prompt i would type:

copy con C:\Windows\Desktop\filename.bat
dir <f6>

but when you type ^z (F6 cheractor) into a batch file it doesnt work...

please give me the exact syntax for the above project.

2k dummy

  • Guest
Re: ^Z in batch file
« Reply #1 on: November 25, 2004, 08:16:54 PM »
There is no reason to insert a ^z into a batch file except when you use copy con to create it. That is nothing more than an end of file marker that tells DOS you are finished entering the file and to write the file to disk.

MalikTous

  • Guest
Re: ^Z in batch file
« Reply #2 on: November 25, 2004, 10:22:20 PM »
Ctrl-Z is ASCII 1A (26 decimal) EOF character, and is used in terminal communications to end a file create with COPY command. To create a text file in a batch like that, simply use

echo dir /a > c:\filename.bat

franksimari

  • Guest
Re: ^Z in batch filec
« Reply #3 on: November 28, 2004, 09:47:21 AM »
i do not to correct but

echo  dir  /c is the wrong switch

if anything  use
  echo  dir  c:\   > dirc.bat

or
   echo dir c:\subdirec >subdir.bat