I have written huge MS DOS Batch file. To test this batch file I need to execute some lines only and want to hide/comment out remaining.
I have some existing comment lines starting with ::
hence I cannot use ::
anymore as it will scramble all comments.
How can I solve this problem?
The batch language doesn't have comment blocks, though there are ways to accomplish the effect. You can use GOTO Label and :Label for making block comments. Or, If the comment block appears at the end of the batch file, you can write EXIT at end of code and then any number of comments for your understanding.
A batch file can be commented using either two colons :: or a REM command. The main difference is that the lines commented out using the REM command will be displayed during execution of the batch file (can be avoided by setting @echo off ) while the lines commented out using :: , won't be printed.
During execution of a batch file, DOS will display (but not act on) comments which are entered on the line after the REM command. You cannot use separators in the comment except the space, tab, and comma. To keep DOS from interpreting commands in a comment line, enclose the command in quotes.
You can use a goto
to skip over code.
goto comment ...skip this... :comment
If you want to add REM at the beginning of each line instead of using GOTO, you can use Notepad++ to do this easily following these steps:
Repeat steps to uncomment
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With