Home / Microsoft / Microsoft DOS / ^Z in batch file
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: ^Z in batch file  (Read 1488 times)
UNLISTED
Guest
« 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.
IP logged
2k dummy
Guest
« 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.
IP logged
MalikTous
Guest
« 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
IP logged
franksimari
Guest
« 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
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / ^Z in batch file « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.107 seconds with 18 queries.