我想要它,所以当我点击一个批处理文件时,它会将很多东西复制到批处理文件中,我尝试过使用>>方法( echo example>>example.txt ),但它只复制了我想要复制的内容的一半,我有很多行,所以我想知道是否有最多的行要复制,如果没有为什么它没有复制我想要复制的所有东西?(我希望它复制大约150行)编辑:这是我正在尝试做的事情:
SET FILECONTENTS=1.) In the url of the item you want to use the buy button on, Put Javascript:startbuy();^
2.) Inspect element on buy button.^
3.) Put the code at the bottom in it.^
4.) You now no longer need to refresh once the item goes onsale.^
<input type="submit" class="newPurchaseButton" value=""^
ECHO %FILECONTENTS%>>testingfile.txt到目前为止,它还不起作用。
发布于 2012-09-06 08:08:23
大多数人这样做是错误的,在脚本中有100个echo语句,每行一个,但有一种更好的方法。最好的方法是:
@echo off
setlocal EnableDelayedExpansion
set "LA=^<"
set "RA=^>"
:: 2 blank lines required below set NLM !
set NLM=^
set NL=^^^%NLM%%NLM%^%NLM%%NLM%
SET FILECONTENTS=^
1.) In the url of use the buy button on, Put Javascript:startbuy();!NL!^
2.) Inspect element on buy button.!NL!^
3.) Exclamation^^! Put the code at the bottom in it.!NL!^
4.) You now no longer need to refresh once the item goes onsale.!NL!^
!LA!input type=^"submit^" class=^"newPurchaseButton^" value=^"^"!RA!
ECHO %FILECONTENTS%
ECHO %FILECONTENTS%>>test.txt
pause发布于 2012-09-08 04:43:50
当您尝试使用<>字符时,您的代码会失败,但这些字符是批处理的特殊字符(它们是为重定向保留的)。
但是您可以避开它们,另外,您应该对echo命令使用延迟扩展,以避免出现同样的问题。
setlocal EnableDelayedExpansion
SET FILECONTENTS=^
1.) In the url of the item you want to use the buy button on, Put Javascript:startbuy();^
2.) Inspect element on buy button.^
3.) Put the code at the bottom in it.^
4.) You now no longer need to refresh once the item goes onsale.^
^<input type="submit" class="newPurchaseButton" value=""^>
>>testingfile.txt ECHO !FILECONTENTS!编辑:另一种方式
如果您还想创建换行符,则可以在块中使用简单的echo语句
(
echo 1.^) In the url of the item you want to use the buy button on, Put Javascript:startbuy(^);
echo 2.^) Inspect element on buy button.
echo 3.^) Put the code at the bottom in it.
echo 4.^) You now no longer need to refresh once the item goes onsale.
echo ^<input type="submit" class="newPurchaseButton" value=""^>
) > testingfile.txt有关更多解决方案,请阅读SO:Splitting Doublequoted Line Into Multiple Lines in Windows Batch
https://stackoverflow.com/questions/12290854
复制相似问题