Search found 71 matches

by sst
25 Jan 2019 14:11
Forum: DOS Batch Forum
Topic: doskey output can't always be captured
Replies: 3
Views: 273

Re: doskey output can't always be captured

The behavior may seem strange, but it' not strange at all Completely unrelated to my other recent posts, I noticed something very strange with doskey today: I occasionally search commands in the command history by typing something like: doskey /history | findstring SOMEPROGRAM As I'm lazy, to have l...
by sst
31 Dec 2018 01:44
Forum: DOS Batch Forum
Topic: Directly reading from pipe by the parent CMD process
Replies: 19
Views: 1321

Re: Directly reading from pipe by the parent CMD process

Hi Dave, Thanks for your feedback. Well I can't deny the fact that my write up is far from perfect, so, at least it could be one of the reasons behind your confusion. As it is obvious, English is not my native language. That's not an excuse, but anyway, It's not an easy task for me to write in Engli...
by sst
23 Dec 2018 08:38
Forum: DOS Batch Forum
Topic: Advice Question - how to check to see if file has already been ran?
Replies: 3
Views: 320

Re: Advice Question - how to check to see if file has already been ran?

If you can consider changing the design of your script then something like this should do the job for %%A in ("%FDMEE_BIN%\*") do call :RUNLOAD "%%~A" But if you want to stick with your current design then you can try this less efficient method REM Initialization dir /a-d /b "%FDMEE_BIN%\" >"%TEMP%\...
by sst
22 Dec 2018 06:00
Forum: DOS Batch Forum
Topic: Directly reading from pipe by the parent CMD process
Replies: 19
Views: 1321

Re: Directly reading from pipe by the parent CMD process

This is the script that demonstrates all three kinds of pipe stealing by reading from pipe, writing to, or writing to and reading from pipe from the same process (self pipe) within CMD/batch scripts. This script is just intended to demonstrate the concept, not to promote using the techniques in prod...
by sst
22 Dec 2018 04:24
Forum: DOS Batch Forum
Topic: Directly reading from pipe by the parent CMD process
Replies: 19
Views: 1321

Re: Directly reading from pipe by the parent CMD process

I know there are differences, but you got the outcomes incorrect. Yes you are correct that was my mistake. I know echo !str! | break works (assuming delayed expansion was enabled before of course). I was intended to use (echo !str! )| break , and my description was not precise for why it is not wor...
by sst
21 Dec 2018 19:37
Forum: DOS Batch Forum
Topic: Directly reading from pipe by the parent CMD process
Replies: 19
Views: 1321

Re: Directly reading from pipe by the parent CMD process

PipeBlocking.bat 4095 --- Works without blocking PipeBlocking.bat 4096 --- Blocks Hi Jeb, Except one thing: you forgot that an extra space follows by echo %%testStr%% which will be inserted by parser. You have to remove one more char from the testStr set "testStr=!testStr:~0,-3!" , PipeBlocking.bat...
by sst
16 Dec 2018 00:37
Forum: DOS Batch Forum
Topic: Directly reading from pipe by the parent CMD process
Replies: 19
Views: 1321

Directly reading from pipe by the parent CMD process

I've found a way to directly reading from pipe by the parent CMD process that initiated the pipe connection between two child processes. So it is possible to directly store a command/program output in a variable without using FOR /F It has it's own limitations and may not be suitable for every day u...
by sst
24 Sep 2018 00:06
Forum: DOS Batch Forum
Topic: copy partition script
Replies: 3
Views: 1069

Re: copy partition script

Try HDClone https://www.miray.de/products/sat.hdclone.html
It supports automation through its CLI. But I'm not sure if the free version has all the capabilities you need.
by sst
20 Sep 2018 00:02
Forum: DOS Batch Forum
Topic: Why ~dpf ?
Replies: 9
Views: 2468

Re: Why ~dpf ?

You said it was a “workaround for CMD %~0 bug.” Please give an explanation/reference. Hi Sponge Belly, Although carlos has described the bug, here are some more references: This SO Q/A CMD: failure of %~d0 when CALL quotes the name of the batch file There are some good and thorough analysis and tes...
by sst
18 Sep 2018 20:28
Forum: DOS Batch Forum
Topic: How to detect if input comes from pipe or redirected file
Replies: 9
Views: 3687

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

But the real kicker is when I redirect stderr to stdin: call detectRedirect.bat #8 stderr2stdin 2>&0 This crashes and kills the console :!: cmd will not be crashed by this, rather it will terminate itself in a controlled manner. At first I thought stack overflow might be the cause of the terminatio...
by sst
02 Sep 2018 12:22
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 27103

Re: foolproof counting of arguments

The solution I posted is not complete, it does not report the used and unused handles properly if handle 9 is already in use. I was very tired, I completely forgot to take that into account, and honestly was not able to do that, my mind was down. I should never post anything when tired. Here is the ...
by sst
01 Sep 2018 12:17
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 27103

Re: foolproof counting of arguments

As I feared, I was not able to prevent an unwanted error message on the screen when detecting the lowest available handle. I found a way to prevent the error message while detecting the available handles. If we do the detection while stderr is redirected, then we just need to find the first 2 avail...
by sst
31 Aug 2018 04:47
Forum: DOS Batch Forum
Topic: How to Use FC (File Compare) from the Windows Command Prompt
Replies: 4
Views: 1425

Re: How to Use FC (File Compare) from the Windows Command Prompt

i fear it's comparing the contents of all files rather than just telling which files exist in folder1 that are missing in folder2. Yes, FC just compares the file contents nothing more. You mean something like this? Honestly I get confused as I'm sure you know this. for %A in (folder1\*) do @if not ...
by sst
29 Aug 2018 16:26
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 27103

Re: foolproof counting of arguments

It could be useful when someone found a solution to some of the above points, or even how to close the current cmd window :?: Nice trick jeb The main thread can be terminated, but this is reasonable only when batch file called from command line and not from another batch file. The trick is to redir...
by sst
29 Aug 2018 14:14
Forum: DOS Batch Forum
Topic: Print Result in Variable Obtained by for
Replies: 6
Views: 775

Re: Print Result in Variable Obtained by for

That's because WMIC outputs in Unicode, FOR /F converts it to ANSI encoding but before that, it will strip the LineFeeds and splits the output to individual lines then converts the text, the result is that you end up with orphaned carriage return characters. So the last line that FOR /F passes to th...