1.

Solve : ^Z in batch file?

Answer»

my problem:

if you type at the prompt:

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

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

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

please give me the exact syntax for the above project.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.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.bati 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



Discussion

No Comment Found