Share via

Batch Help

Anonymous
2014-06-08T22:03:57+00:00

I want to write this line to text file

from a batch file.

echo   >temp.txt

I won't work, I have tried  echo ^ 

and echo ^&^#160;

Help

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2014-06-23T19:38:11+00:00

    I have solved it with

    echo. <^pre^> what        ever               with         spaces             ^</pre^> >>filename.html

    it will keep the spaces

    Was this answer helpful?

    0 comments No comments
  2. LemP 74,945 Reputation points Volunteer Moderator
    2014-06-09T20:51:19+00:00

    What are you trying to do?

    The string   is HTML for a non-breaking space (also written  )

    The command interpreter doesn't understand HTML.

    The command interpreter recognizes the ampersand (&) as a "command separator" which simply means that it treats whatever follows the & as a command.  Thus, if you type the following in a command prompt

       echo  

    the command interpreter attempts to interpret #160; as a command -- and it can't.  Similarly, the command interpreter recognizes the semicolon (;) as a blank space (I think).

    C:\Users\LemP>echo   > temp.txt

    ECHO is on.

    '#160' is not recognized as an internal or external command,

    operable program or batch file.

    The caret character (^) "escapes" the ampersand, allowing the command interpreter to treat it as just another character.  Thus the following

    C:\Users\LemP>echo ^  > temp.txt

    results in the creation of a file named temp.txt that contains the 6 characters  

    So ... depending on what you want your batch file to accomplish, there may (or may not) be a way to achieve that goal.

    The following pages may be of interest:

    http://judago.webs.com/batchoperators.htm

    http://www.robvanderwoude.com/escapechars.php

    Was this answer helpful?

    0 comments No comments