What is a command that will write a command to a file? [duplicate]
up vote
1
down vote
favorite
This question already has an answer here:
How can I add greater than and less than into a batch file variable
3 answers
I would like to make a batch file that writes a command to a batch file. I have tried using
@echo "@echo this is a test>test.txt">testBat.bat
Which gives me the output in testBat.bat of:
"@echo this is a test>test.txt"
This issue is, it still has the quotations around it in the batch file, and running it without the quotes gives me:
"this is a test"
So running it without the quotes just puts the text in the batch file. And after spending a half an hour looking I couldn't find if this was at all possible.
batch-file cmd
New contributor
marked as duplicate by phuclv, aschipfl
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 18 at 18:30
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
1
down vote
favorite
This question already has an answer here:
How can I add greater than and less than into a batch file variable
3 answers
I would like to make a batch file that writes a command to a batch file. I have tried using
@echo "@echo this is a test>test.txt">testBat.bat
Which gives me the output in testBat.bat of:
"@echo this is a test>test.txt"
This issue is, it still has the quotations around it in the batch file, and running it without the quotes gives me:
"this is a test"
So running it without the quotes just puts the text in the batch file. And after spending a half an hour looking I couldn't find if this was at all possible.
batch-file cmd
New contributor
marked as duplicate by phuclv, aschipfl
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 18 at 18:30
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Escaping characters like ", <, >, >>, or | in the arguments to a batch file, Batch character escaping, Escape percent in bat file, Escape special character in a windows batch, Special Characters in Batch File
– phuclv
Nov 18 at 14:51
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This question already has an answer here:
How can I add greater than and less than into a batch file variable
3 answers
I would like to make a batch file that writes a command to a batch file. I have tried using
@echo "@echo this is a test>test.txt">testBat.bat
Which gives me the output in testBat.bat of:
"@echo this is a test>test.txt"
This issue is, it still has the quotations around it in the batch file, and running it without the quotes gives me:
"this is a test"
So running it without the quotes just puts the text in the batch file. And after spending a half an hour looking I couldn't find if this was at all possible.
batch-file cmd
New contributor
This question already has an answer here:
How can I add greater than and less than into a batch file variable
3 answers
I would like to make a batch file that writes a command to a batch file. I have tried using
@echo "@echo this is a test>test.txt">testBat.bat
Which gives me the output in testBat.bat of:
"@echo this is a test>test.txt"
This issue is, it still has the quotations around it in the batch file, and running it without the quotes gives me:
"this is a test"
So running it without the quotes just puts the text in the batch file. And after spending a half an hour looking I couldn't find if this was at all possible.
This question already has an answer here:
How can I add greater than and less than into a batch file variable
3 answers
batch-file cmd
batch-file cmd
New contributor
New contributor
edited Nov 18 at 1:11
Nick
19.1k51433
19.1k51433
New contributor
asked Nov 18 at 1:07
Randy Titler
83
83
New contributor
New contributor
marked as duplicate by phuclv, aschipfl
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 18 at 18:30
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by phuclv, aschipfl
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 18 at 18:30
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Escaping characters like ", <, >, >>, or | in the arguments to a batch file, Batch character escaping, Escape percent in bat file, Escape special character in a windows batch, Special Characters in Batch File
– phuclv
Nov 18 at 14:51
add a comment |
1
Escaping characters like ", <, >, >>, or | in the arguments to a batch file, Batch character escaping, Escape percent in bat file, Escape special character in a windows batch, Special Characters in Batch File
– phuclv
Nov 18 at 14:51
1
1
Escaping characters like ", <, >, >>, or | in the arguments to a batch file, Batch character escaping, Escape percent in bat file, Escape special character in a windows batch, Special Characters in Batch File
– phuclv
Nov 18 at 14:51
Escaping characters like ", <, >, >>, or | in the arguments to a batch file, Batch character escaping, Escape percent in bat file, Escape special character in a windows batch, Special Characters in Batch File
– phuclv
Nov 18 at 14:51
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Try this:
@echo @echo this is a test^>test.txt>testBat.bat
I vaguely remember that cmd uses ^
as an escape character.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Try this:
@echo @echo this is a test^>test.txt>testBat.bat
I vaguely remember that cmd uses ^
as an escape character.
add a comment |
up vote
1
down vote
accepted
Try this:
@echo @echo this is a test^>test.txt>testBat.bat
I vaguely remember that cmd uses ^
as an escape character.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Try this:
@echo @echo this is a test^>test.txt>testBat.bat
I vaguely remember that cmd uses ^
as an escape character.
Try this:
@echo @echo this is a test^>test.txt>testBat.bat
I vaguely remember that cmd uses ^
as an escape character.
answered Nov 18 at 1:18
melpomene
56.3k54387
56.3k54387
add a comment |
add a comment |
1
Escaping characters like ", <, >, >>, or | in the arguments to a batch file, Batch character escaping, Escape percent in bat file, Escape special character in a windows batch, Special Characters in Batch File
– phuclv
Nov 18 at 14:51