REM it starts here the section below can be safely erased once the file is customisedECHO Hey you need to edit this file before running it! Check the instructions insideECHO Now press ctrl-c to interrupt execution or enter to continuePAUSEREM erase the section above once you have customised the filepython executed1.pyECHO Skipping some stuff nowGOTO Endpython skipped1.pypython skipped2.py:ENDpython executed2.py
SOME CODE
GOTO LABEL ::REM OUT THIS LINE TO EXECUTE THE CODE BETWEEN THIS GOTO AND :LABEL
SOME CODE TO SKIP.LAST LINE OF CODE TO SKIP
:LABELCODE TO EXECUTE
@ECHO OFFREM Do something••REM End of code; use GOTO:EOF instead of EXIT for Windows NT and laterEXIT
Start of comment block at end of batch fileThis line is comment.And so is this line.And this one...
@echo off
echo starting script
goto :end_commentscomented lineone more commented line:end_comments
echo continue with the script
(echo demonstration offrem/||(lines withcomments)echo multiline comment insideecho brackets)
以及用宏美化的相同技术:
@echo off
::GOTO comment macroset "[:=goto :]%%"::brackets comment macrosset "[=rem/||(" & set "]=)"
::testingecho not commented 1
%[:%multilinecomment outside of brackets%:]%
echo not commented 2
%[:%second multilinecomment outside of brackets%:]%
::GOTO macro cannot be used inside forfor %%a in (first second) do (echo first not commented line of the %%a execution%[%multi linecomment%]%echo second not commented line of the %%a execution)
@echo offset parameter1=%1%REM test if the parameter 1 was receivedif defined parameter1 echo The parameter 1 is %parameter1% &REM Display the parameter