Search found 6 matches
- 15 Oct 2016 08:33
- Forum: DOS Batch Forum
- Topic: Multi-line indentation
- Replies: 8
- Views: 9620
Re: Multi-line indentation
Thank you for your explanation, penpen. It is really helpful to me. The next character is treated as no special character (by the scanner of the command line interpreter). This is particularly useful to know. To get a better understanding of how the "scanner/lexer" works, I did some tests ...
- 15 Oct 2016 06:50
- Forum: DOS Batch Forum
- Topic: %errorlevel% expansion within subroutine
- Replies: 6
- Views: 7799
Re: %errorlevel% expansion within subroutine
Okay, I guess I have overlooked things again . The directory existence check is necessary because the file has to be created even if the directory already exists, which was not the case in my previous code. The reason I need to know whether md succeeded is because the subroutine has to abort operati...
- 15 Oct 2016 05:25
- Forum: DOS Batch Forum
- Topic: %errorlevel% expansion within subroutine
- Replies: 6
- Views: 7799
Re: %errorlevel% expansion within subroutine
It seems I have completely overlooked the fact that %errorlevel% was being expanded within the block of an IF statement. I decided to drop the initial directory existence check in the subroutine since it didn't provide any benefits in this particular case. Though, if the directory existence check wa...
- 15 Oct 2016 03:44
- Forum: DOS Batch Forum
- Topic: Multi-line indentation
- Replies: 8
- Views: 9620
Re: Multi-line indentation
It seems that I used the wrong terminology for the double pipe operator. I still don't understand the ruling of the ^ anchor operator, an explanation why certain codes can be split up to the next line and others don't, would be very much appreciated.
- 14 Oct 2016 18:40
- Forum: DOS Batch Forum
- Topic: %errorlevel% expansion within subroutine
- Replies: 6
- Views: 7799
%errorlevel% expansion within subroutine
I'm trying to check if md is executed successfully from within a subroutine. The problem is that %errorlevel% will always be 0, even if md has failed to create a directory. It seems that %errorlevel% is expanded before md is executed. This behaviour of %errorlevel% only seems to occur when I try to ...
- 14 Oct 2016 16:22
- Forum: DOS Batch Forum
- Topic: Multi-line indentation
- Replies: 8
- Views: 9620
Multi-line indentation
I'm looking for an explanation why I cannot put the carrot behind the OR operator: md "dir" ||^ echo Failed to make dir But putting the carrot in front of OR seems to be fine. md "dir" ^ || echo Failed to make dir And is there a way to put the opening parenthesis of an if-block o...