开发者

Batch file shows batch commands

I got a batchfil开发者_Python百科e with a length of 4776 lines. Now i want the batchfile to show the commands and text from the batchfile itself I've written. Anticipated thanks VVW


I like adding this at the beginning of my batch scripts:

@ECHO OFF
IF /i {%1}=={ECHO} ECHO ON&SHIFT

This checks if the first argument is "ECHO" (case-insensitive). If it is, it turns ECHO ON, and then shifts the arguments such that %2 becomes %1, %3 becomes %2. This way the script can behave as though you ran it normally, but with ECHO ON.


Remove the below line from the batch file.

@echo off

Or make it on by doing

@echo on


Try putting your code in a variable, then print it.

mycode = %Code Code Code%
echo %mycode%


Try putting this ain your batch file.

@type %0


Maybe I am misunderstanding things but it seems like everyone is misunderstanding where the "@" symbol is necessary. If you have this:

@echo off

Then you run commands like this:

@call mycommand.bat

But, if you have this at the top of your file:

echo off

Then, your commands are silenced like so:

call mycommand.bat


You could just open the command line and type this

type yourbatchfilename.bat >> code.txt

This would write your whole thing again in a txt file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜