Search found 923 matches

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

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

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

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

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

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

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

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

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

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

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...
by jeb
13 Jun 2018 00:43
Forum: DOS Batch Forum
Topic: Dateien verbinden und / Fehler bei Inhalte suchen
Replies: 2
Views: 919

Re: Dateien verbinden und / Fehler bei Inhalte suchen

Hi FireBuff, the language for this forum is english, it would be polite to translate your question. Like Newbee wrote, I suppose the problem is not in your code. Instead it's probably that findstr simply finds two lines with "VV011". You could test this, add /N to findstr ("findstr /N ...") this wil...
by jeb
28 May 2018 23:00
Forum: DOS Batch Forum
Topic: How to mask a blank inside nested quotes?
Replies: 11
Views: 2604

Re: How to mask a blank inside nested quotes?

Hi pstein,

as sst said, it's a problem how FOR/F invokes cmd.exe.
It can be solved with the additional quotes like the sample of sst.

Or you prefix your command with CALL

Code: Select all

for /F usebackq %%L in (`CALL "%PROG%myprog.exe" ...... %%F`) do set %%L
by jeb
25 May 2018 02:32
Forum: DOS Batch Forum
Topic: Get arguments without temporary file
Replies: 24
Views: 4418

Re: Get arguments without temporary file

@JanAntonin I'm missing the part where the arguments are transfered to a variable. @Ed Dyreen I optimized the code a bit for macronisation, remove labels, findstr. That looks quite good, BUT to remove the findstr after 'doskey /macros' isn't a good idea, as it sets any amount of variables, for each ...
by jeb
22 May 2018 23:46
Forum: DOS Batch Forum
Topic: Get arguments without temporary file
Replies: 24
Views: 4418

Re: Get arguments without temporary file

It doesn't seem to like spaces in current directory. :( Stupid jeb code, we always needs to fix stupid jeb code :evil: Yes, and I'm the first one who criticize such sloppy code :( But beside that bugs I tested with line feeds and it suprises me, as line feeds are converted to ampersands. @ech off s...
by jeb
22 May 2018 15:04
Forum: DOS Batch Forum
Topic: Get arguments without temporary file
Replies: 24
Views: 4418

Re: Get arguments without temporary file

I think you are on the right way. But I can't understand why you parse the options before launching the test script? Why you don't use it simply calling like GetParam.bat %*? The problem for the unittest is the fact, that I don't know a simple way to show the argument that will be used and use that...