Search found 1761 matches

by penpen
23 Sep 2019 05:43
Forum: DOS Batch Forum
Topic: Method of 'whitelisting' various characters then replacing any characters in strings that don't match?
Replies: 4
Views: 4970

Re: Method of 'whitelisting' various characters then replacing any characters in strings that don't match?

Just so I understand we're referring to the same thing, did you mean 'do you know for sure that the blacklist is longer '? Sorry, i meant the whitelist... (instead of the blacklist - i leave that error in my above post). That's the thing, I'm unsure how many Unicode characters the program has issue...
by penpen
22 Sep 2019 02:06
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: 10
Views: 6990

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

You may encapsulate the initialization and building of the menues in function calls: @echo off cls setlocal enableExtensions enableDelayedExpansion call :initMenu "choice" call :addMenuItem "choice" "ball" "value 1" call :addMenuItem "choice" "sun" "value 2" call :addMenuItem "choice" "land" "value ...
by penpen
22 Sep 2019 01:38
Forum: DOS Batch Forum
Topic: Method of 'whitelisting' various characters then replacing any characters in strings that don't match?
Replies: 4
Views: 4970

Re: Method of 'whitelisting' various characters then replacing any characters in strings that don't match?

I know the reverse is possible: defining characters one wants to be replaced, but that could be a very long list given how many potential Unicode characters there are. Do you know for sure, that the Blacklist is shorter? How many characters are in that list? With which characters does that program ...
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: 10
Views: 6990

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: 10
Views: 6990

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: 12236

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: 3372

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: 12236

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: 3372

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: 3372

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: 2523

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: 2523

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: 12236

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: 12236

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: 12236

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...