2016-11-26 4 views
0

にリテラルテキストを付加すると、私のコードだからここにファイル

@echo off 
:top 
cls 
echo Welcome to your custom terminal, Ayden 
set /p enter=Enter: 
if %enter% == start echo start > temp.txt 
if %enter% == start goto top 
if %enter% == live goto live 
del executable.bat >nul 
echo @echo off > executable.bat 
notepad executable.bat 
goto top 
:live 
cls 
:overthere 
set /p input=Ayden: 
(
echo @echo off 
) > executable.bat 
echo echo %input% > temp2.txt >> executable.bat 
pause 
:overhere 
if not exist temp2.txt goto overhere 
type temp2.txt 
del temp2.txt 
goto overthere 

である。しかし、「executable.batは」この

@echo off 
echo dir 

を含む終わる私は「エコーDIR」を作ることができますどのような方法があります"echo dir> temp2.​​txt"に入りますか? 私は見積もりを試してみましたが、それでも問題は1つあります。それはファイルにエコーされていて、まだ引用符が付いています。

+0

[Enter]/[return]を入力すると、比較の左側が空であるため、バッチが失敗します。これを避けるには、定数を両側に追加します。 – LotPings

答えて

2

エコーする>のようにエコーする必要があります。^>

また、>>>の前にスペースを入れてください。そのスペースもエコーされるので注意してください。

関連する問題