Reputation: 476
I want to learn echo to file, with batch programing.
my batch :
@echo off
echo Hello World > c:\text.txt
Text.txt result :
Hello World
It is Seccessfully
But If my batch file (Added '"'):
@echo off
echo Hello '"' World > c:\text.txt
Result :
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users>echo Hello '"' World > c:\text.txt
Hello '"' World > c:\text.txt
Why text.txt not created?
Upvotes: 0
Views: 437
Reputation: 37569
you should escape the single double quote:
echo Hello '^"' World>test.txt
otherwise the echo
parser is waiting for the closing double quote and the >
redirection remains escaped by quote.
Upvotes: 4