Search found 918 matches

by jeb
28 Jan 2019 03:01
Forum: DOS Batch Forum
Topic: Is there any standard equivalent of a .bashrc script for cmd?
Replies: 10
Views: 2239

Re: Is there any standard equivalent of a .bashrc script for cmd?

Hi siberia-man, - It is reliable to detect an invocation from FOR/F. - Invokations from pipes doesn't trigger the autostart at all. - When a new instance of cmd.exe is launched directly it can fail, as it's possible to add any possible parameter, but then it only drops the additional commands. It sh...
by jeb
28 Jan 2019 01:48
Forum: DOS Batch Forum
Topic: Is there any standard equivalent of a .bashrc script for cmd?
Replies: 10
Views: 2239

Re: Is there any standard equivalent of a .bashrc script for cmd?

Hi, I'm using the registry key to start a batch file, that adds some doskey macros. BUT it's a bit tricky, as the batch file will also be called for new cmd instances inovked by FOR /F :!: If the batch file doesn't check that, you can get really strange behaviour in all of your batch files. Think of...
by jeb
25 Jan 2019 13:45
Forum: DOS Batch Forum
Topic: doskey output can't always be captured
Replies: 3
Views: 900

Re: doskey output can't always be captured

Hi jfl, interesting :) I tried to build a simple workaround history.bat @echo off doskey /history | findstr /n "^" It works as expected 1:doskey /history 2:echo test 3:npp hist.bat 4:hist .. and I thought that the output of the findstr should work normal, but ... history.bat | more Still outputs not...
by jeb
21 Dec 2018 08:31
Forum: DOS Batch Forum
Topic: Directly reading from pipe by the parent CMD process
Replies: 19
Views: 3558

Re: Directly reading from pipe by the parent CMD process

Hi Dave, I tested your code Windows 7 x64: 4096 Windows XP x32: 4096, but FINDSTR doesn't work reliable And I retested the blocking limit of pipe blocks. First a testString of the configured size is send. The a "second line" is send. If the blocking is active the second line is send only when thread...
by jeb
06 Dec 2018 05:57
Forum: DOS Batch Forum
Topic: Ampersand is directory name - Batch not working
Replies: 2
Views: 575

Re: Ampersand is directory name - Batch not working

Hi Andreas, I suppose there is more in your batch file, because I just tested this sample batch file in a directory named "C:\temp\amp & ersand\" and it works @echo off setlocal EnableDelayedExpansion echo cmdcmdline: !cmdcmdline! start "Firefox" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" ...
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: 3983

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

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

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

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

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

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

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

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

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

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