Search found 883 matches

by jeb
13 Nov 2018 00:45
Forum: DOS Batch Forum
Topic: Writing Batch code in an easier way with the aid of macros
Replies: 16
Views: 1645

Re: Writing Batch code in an easier way with the aid of macros

Hi siberia-man, I currently can't follow Aacini's technic :?: , but it looks impressive ( I have to spend more time on this). But I can answer your question. A quite exciting technique for scripting batch macros. One this I can't understand. When you code the beginning of any macro you use something...
by jeb
13 Nov 2018 00:36
Forum: DOS Batch Forum
Topic: Strange behaviour with ansi sequence
Replies: 3
Views: 35

Re: Strange behaviour with ansi sequence

Hi J'aitreschaud, ESC[ <n> m is the Select Graphic Rendition sequence, it sets the display attributes, they affect each NEW character that will be written, that's all. In your case, it changes the complete background after the cls, as the complete screen will be filled with spaces. To reset that set...
by jeb
04 Nov 2018 13:51
Forum: DOS Batch Forum
Topic: call expands variables / parameters differently with double percent signs
Replies: 1
Views: 79

Re: call expands variables / parameters differently with double percent signs

Hi pieh-ejdsch, Then with a double circumflex final. The parameters are passed into the :Sub but with circumflex at the end these parameters expand to a rat tail. The caret/circumflex will be doubled always by a CALL command, normally this isn't visible, as the doubled carets are used as escape char...
by jeb
29 Sep 2018 09:30
Forum: DOS Batch Forum
Topic: Source code for MS-DOS v1.25 and v2.0
Replies: 2
Views: 663

Source code for MS-DOS v1.25 and v2.0

Hi,

today Microsoft published MS-Dos v1.25 and v2.0 as Open Source at github

jeb
by jeb
18 Sep 2018 02:52
Forum: DOS Batch Forum
Topic: How to detect if input comes from pipe or redirected file
Replies: 9
Views: 2841

Re: How to detect if input comes from pipe or redirected file

I used an extra test script, my main script has the name detectRedirect.bat @echo off call detectRedirect.bat #1 stdout_default call detectRedirect.bat #2 stdout2Nul > nul call detectRedirect.bat #3 stderr2Nul 2> nul call detectRedirect.bat #4 both2Nul 1> nul 2> nul #1 stdout_default STDOUT = 0 STDE...
by jeb
17 Sep 2018 23:27
Forum: DOS Batch Forum
Topic: How to detect if input comes from pipe or redirected file
Replies: 9
Views: 2841

Re: How to detect if input comes from pipe or redirected file

@siberia-man It's cool and simple :D Yesterday, I build a new solution to detect STDOUT redirection. Currently, the detection for STDERR redirection is not working correct. [strike]It produces a wrong result when the STDOUT redirection is active.[/strike] Edit: I found a simple way for STDERR, 1>&2 ...
by jeb
11 Sep 2018 05:42
Forum: DOS Batch Forum
Topic: how to programmatically escape percent signs %
Replies: 1
Views: 612

Re: how to programmatically escape percent signs %

Hi sage12, you should use delayed expansion, too avoid any problems with special charaters. setlocal EnableDelayedExpansion "%JAVA_HOME%" -classpath %CLASSPATH% javaprogram !uid! !pwd! But your main problem is a bit difficult. I don't understand, who builds the lines set uid="--uid=theb%renda" set p...
by jeb
31 Aug 2018 05:42
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 24230

Re: foolproof counting of arguments

It is very odd that the extra label is required. I get the wrong prompt in the output if I consolidate the thread redirection label and loop label into a single label. :? I can't see any problem with deleting the :__WaitForParams label, it still works for me. One more thing that seems not good. The...
by jeb
30 Aug 2018 03:41
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 24230

Re: foolproof counting of arguments

instead of start "" / b ... what happens if you do it without /b? It opens a new cmd window, but that doesn't solve the problem that the main thread is still open. The main thread can be terminated, but this is reasonable only when batch file called from command line and not from another batch file...
by jeb
28 Aug 2018 08:05
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 24230

Re: foolproof counting of arguments

I have some new thoughts about this old topic. Two keypoints are relevant. The REM technic currently fails with embedded linefeeds in the parameters %*. And it can't fetch carriage returns, this seems to be impossible as CR's are removed directly after the percent expansion! Now we can use jeb's ide...
by jeb
28 Aug 2018 07:15
Forum: DOS Batch Forum
Topic: Alternate method to get TAB, Carriage return and possibly all others
Replies: 32
Views: 3535

Re: Alternate method to get TAB, Carriage return and possibly all others

Hi sst, clever way to use the buffer overflow without a temporary file. I never thought of your pipe solution. But still it has a bad taste to use a buffer overflow, I'm not convinced that there aren't some nasty side effects. @echo off call :CreateCR setlocal EnableDelayedExpansion echo 12345!CR!# ...
by jeb
28 Aug 2018 01:57
Forum: DOS Batch Forum
Topic: help to create a batch-file
Replies: 2
Views: 210

Re: help to create a batch-file

Hi Pf@nne, you could store the directory names in an array (not really an array, but it has the look and feel). @echo off cls REM ----------------------------------------- REM Verzeichnis auslesen und anzeigen REM ----------------------------------------- setlocal EnableDelayedExpansion cd _customDe...
by jeb
01 Aug 2018 06:12
Forum: DOS Batch Forum
Topic: Reading a hidden password via a FINDSTR bug
Replies: 10
Views: 804

Re: Reading a hidden password via a FINDSTR bug

Works fine on my Win7 x64 Professional. I'm astonished at the findstr redirection to CON. I didn't expected any color effects for redirected text to CON at all, I expected to see control codes like for CLS > CON I saw this effect before, when I build the findstr color technic, but I always assumed t...
by jeb
25 Jun 2018 07:13
Forum: DOS Batch Forum
Topic: Change the influence of one batch file when other one is running
Replies: 3
Views: 516

Re: Change the influence of one batch file when other one is running

two.bat

Code: Select all

@echo off
call :secretLabel
exit /b

:secretLabel
one.bat
Obviously 8) , this will start :secretLabel in one.bat

You don't need to start one.bat before
by jeb
18 Jun 2018 11:32
Forum: DOS Batch Forum
Topic: Line read in a loop from a file doesn't assign properly in batch program
Replies: 2
Views: 341

Re: Line read in a loop from a file doesn't assign properly in batch program

Hi jrahman, I closed your question on StackOverlflow as it is a duplicate of Variables in batch not behaving as expected . There is explained why your echo %testCaseName% fails. Percent expansion is evaluated when a block is parsed, before it will be executed. So in your sampe %testCaseName% is expa...