Search found 1698 matches

by penpen
21 Sep 2019 18:26
Forum: DOS Batch Forum
Topic: [Resolved] For loop to do something with all variables beginning with a string [also find variables order of appearance]
Replies: 9
Views: 140

Re: [Resolved] For loop to do something with all variables beginning with a string [also find variables order of appeara

The thing is, this will be used for some simple user settings so I'm not really counting on them to hand-number them each time they want the order changed. I'm not sure what you mean there... . In case you want the order in a simpler format, where you have to change only one index per entry in your...
by penpen
17 Sep 2019 20:01
Forum: DOS Batch Forum
Topic: [Resolved] For loop to do something with all variables beginning with a string [also find variables order of appearance]
Replies: 9
Views: 140

Re: For loop to do something with all variables beginning/prefixed with a string

but most of the times I experimented with it in a for loop as the command ( in (set example-) do ) an error returned 'The system cannot find the file set.'. You missed a pair of ' characters: @echo off setlocal enableExtensions disableDelayedExpansion set example-foo=something set example-bar=else ...
by penpen
16 Sep 2019 19:42
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 4905

Re: Closing parenthesis prevents escape of subsequent special character operator

It was an attempt to address your question about why the parser behaves differently depending on the command token and why it does not behave the same for e.g. REM and FOR. I probably used bad wording myself (maybe because english isn't my native language and i posted pretty late): Sorry, if i conf...
by penpen
15 Sep 2019 07:46
Forum: DOS Batch Forum
Topic: How To Start @echo off Script After @powershell Script in same BATCHFiLE?
Replies: 6
Views: 143

Re: How To Start @echo off Script After @powershell Script in same BATCHFiLE?

but the script close when it supposed to restart and it should work it does return to the animated text but as soon as I press a key it close.. I can't reproduce that behaviour (sorry - instead it loops all the time until typing "NO" in one of the screens), did you changed something else in your co...
by penpen
15 Sep 2019 07:20
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 4905

Re: Closing parenthesis prevents escape of subsequent special character operator

The parser only cares about the arguments of IF, FOR and REM. To the parser they are not commands but keywords. Each of them have their own parser: ParseIf , ParseFor and ParseRem . (It only recognizes "REM", "REM/?", "FOR", "FOR/?", "IF", "IF/?" as keywords. So something like "REM/ comment" is an ...
by penpen
13 Sep 2019 19:25
Forum: DOS Batch Forum
Topic: How To Start @echo off Script After @powershell Script in same BATCHFiLE?
Replies: 6
Views: 143

Re: How To Start @echo off Script After @powershell Script in same BATCHFiLE?

Sorry, i've forgotten to suppress some echoes.
I changed the above code a little bit (by adding some '@' characters).
Should work now.


penpen
by penpen
13 Sep 2019 03:08
Forum: DOS Batch Forum
Topic: How To Start @echo off Script After @powershell Script in same BATCHFiLE?
Replies: 6
Views: 143

Re: How To Start @echo off Script After @powershell Script in same BATCHFiLE?

If you don't want to change the logic of the PS script, then you should just place it at the end of the combined batch file and just update to skip all lines up to the "@powershell" command. That might help you: @call :psScript :: place the content of the other batch file here @goto :eof :psScript @...
by penpen
11 Sep 2019 02:01
Forum: DOS Batch Forum
Topic: Sorting text file content with batch script,.
Replies: 5
Views: 193

Re: Sorting text file content with batch script,.

one more need help , not i need only first record return ? If understand right, that there are (contrary to your opening post) mutliple records per line in your file "filelist.txt", then that might help you: @echo off setlocal enableExtensions disableDelayedExpansion set "file=D:\filelist.txt" set ...
by penpen
10 Sep 2019 03:51
Forum: DOS Batch Forum
Topic: Sorting text file content with batch script,.
Replies: 5
Views: 193

Re: Sorting text file content with batch script,.

The following might help you:

Code: Select all

@echo off
setlocal enableExtensions disableDelayedExpansion
set "file=D:\filelist.txt"

sort /r "%file%"
penpen
by penpen
09 Sep 2019 04:10
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 4905

Re: Closing parenthesis prevents escape of subsequent special character operator

I don't know the cmd.exe source, but are you sure, that the program doesn't copy parts to somewhere else (and work on that result)? I mean... what is unclear to me is, that i don't get why MS seems to have built a parser, that behaves differently depending on the command token, when splitting the co...
by penpen
05 Sep 2019 00:48
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 4905

Re: Closing parenthesis prevents escape of subsequent special character operator

This was interesting enough to make me spend time in analyzing the parser implementation with the help of debugger and CMD debugging symbols. This effect is due to how the operator precedence is implemented in CMD. Operator precedence in CMD: 1. Command Group and silence operators: (), @ 2. Redirec...
by penpen
01 Sep 2019 13:14
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 4905

Re: Closing parenthesis prevents escape of subsequent special character operator

I should explain my theorie inmore detail (you might want to copy-paste the ascii graphics into a notepad). Example: ( echo some :label1 :label2 echo text ) The optimized parse tree probably looks somehow like that (i removed some parts that are unneccessary for my explaination, to keep that example...
by penpen
29 Aug 2019 11:48
Forum: DOS Batch Forum
Topic: Replace "!" in a variable value when delayed expansion is on
Replies: 7
Views: 1103

Re: Replace "!" in a variable value when delayed expansion is on

GCRaistlin wrote:
29 Aug 2019 10:49
What is "bang"?
I also never heard that; my google-fu lead me to that explaination:
https://ss64.com/bash/syntax-pronounce.html#01


penpen
by penpen
29 Aug 2019 04:32
Forum: DOS Batch Forum
Topic: Replace "!" in a variable value when delayed expansion is on
Replies: 7
Views: 1103

Re: Replace "!" in a variable value when delayed expansion is on

call set "_tmp=%%_tmp:^!=###%%" I don't see, why the call should be neccessary: After you doubled the doublequotes, then you should be in the state which is equivalent to using no doublequotes. At least it does work with your example on win10 (so i wonder if i am missing something): @echo off setlo...
by penpen
25 Aug 2019 18:23
Forum: DOS Batch Forum
Topic: VT100 escape sequences not working in Windows 10?
Replies: 7
Views: 815

Re: VT100 escape sequences not working in Windows 10?

Why is that echo( line in there? I've not seen that before. I see where "Hello World" fails to output without it. The Hello world doesn't fail to output: It is just overwritten immediately. The "echo("-line just echoes an empty line and is needed for the for loop, because the echo command in there ...