- Sep
- 134
- 1
I have created a script to practice with CLIP: and redirects and array.
For this I used the output of "?" to create a short help list for me .
The script uses the Screen statement instead the Echo command.
It was a little surprise, that some commands would not be captured, e.g. BDEBUGGER, CASE etc.
But another effect was really curious:
If it comes to the keyword BDEBUGGER, the line
Really, percentsigntmpfnpercentsign !
What is happend here ?
As a workaround I can use the curly coding from CMD:
I think percentage signs should be forbidden in file specifications, but M$ has unfortunately allowed that.
For this I used the output of "?" to create a short help list for me .
The script uses the Screen statement instead the Echo command.
Code:
Setlocal
Unalias *
Unfunction *
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Set ArrName=arCommandsList
Set FirstLine=0
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:FillSharesArray_Sub
:: Working with the Clipboard
Set z=0
Set arIndex=0
:: Get the complete commandset in the Clipboard
? >CLIP:
:: Count lines to get the Arraysize
Do FOREVER
If "%@CLIP[%z%]" EQ "**EOC**" LEAVE
Set z=%@INC[%z%]
Set arIndex=%@INC[%arindex%]
EndDo
::
UnsetArray /Q %arrname
SetArray /F %arrname[%arIndex%]
:: Now fill the Array
Set z=%FirstLine%
Set arIndex=0
Do FOREVER
If "%@CLIP[%z%]" EQ "**EOC**" LEAVE
Set z=%@INC[%z%]
Set %arrname[%arindex%]=%@CLIP[%@DEC[%z%]]
Set arIndex=%@INC[%arindex%]
EndDo
Echo %@DEC[%@ARRAYINFO[%arrname,1]] lines in the Array
::
:: Scan the array
OPTION //UTF8=YES
Set tmpFN=%@UNIQUE[]
Do z=0 To %@DEC[%@ARRAYINFO[%arrname,1]]
Set Zeile=%@CLIP[%z%]
Do Cmd In /L %zeile
:: Excludings ...
If "%cmd%" EQ "?" ITERATE
:: Some Outputs in combination with Echo %cmd% can lead
:: to unwanted commands, e.g. Echo ON
:: so I use Screen instead
Screen %_row %_column %cmd% ^r^n >>%tmpfn%
:: get the help, if any
%cmd% /? >>%tmpfn%
Echo %@REPEAT[=,%@DEC[%_COLUMNS]] >>%tmpfn
EndDo
EndDo
List %tmpfn%
Erase %tmpfn%
Quit
But another effect was really curious:
If it comes to the keyword BDEBUGGER, the line
%cmd% /? >>%tmpfn%
has create a file named %tmpfn% and redirected the desired output to it !Really, percentsigntmpfnpercentsign !
What is happend here ?
As a workaround I can use the curly coding from CMD:
>>%tmpfn% %cmd% /?
but the question is: What is going on here ?I think percentage signs should be forbidden in file specifications, but M$ has unfortunately allowed that.