Search found 3544 matches

by aGerman
18 Sep 2019 12:46
Forum: DOS Batch Forum
Topic: non-buffering FOR /F alternative
Replies: 2
Views: 42

Re: non-buffering FOR /F alternative

This works great. Thanks Dave! The problem is that the temporary file can become really huge. The C tool I'm talking about is based on a little program that I wrote which is already in use. It may run unattended over weeks or months until someone restarts the computer. It copies local files to a ser...
by aGerman
18 Sep 2019 10:34
Forum: DOS Batch Forum
Topic: non-buffering FOR /F alternative
Replies: 2
Views: 42

non-buffering FOR /F alternative

I developed a little C tool to observe a folder for changes. It is permanently running and writes a line for every event. (Maybe I publish this utility later on if someone finds it useful). If I try to process the lines in a FOR /F loop it won't work because FOR /F buffers the outputted lines until ...
by aGerman
18 Sep 2019 10:02
Forum: DOS Batch Forum
Topic: [Resolved] Alternative xcopy function to Choice - Carriage return as accepted character possible?
Replies: 3
Views: 77

Re: Alternative xcopy function to Choice - Carriage return as accepted character possible?

What I was wondering is whether the Enter key/carriage return could be defined as a valid input Basically you can. The subroutine contains the line if defined c ( which checks if you pressed Enter without any other input before (which is the case if c is not defined at this position). You can't def...
by aGerman
16 Sep 2019 16:47
Forum: DOS Batch Forum
Topic: Wait Process Window to be Activate
Replies: 4
Views: 95

Re: Wait Process Window to be Activate

Still "active" is an ambiguous term. Does it mean that the Window is visible, or does it mean the process has finished loading and has zero CPU usage, or does it mean the window is the topmost window, or does it mean the window has the keyboard focus, ...? We don't even know what this window.exe is ...
by aGerman
15 Sep 2019 05:13
Forum: DOS Batch Forum
Topic: Wait Process Window to be Activate
Replies: 4
Views: 95

Re: Wait Process Window to be Activate

I'm trying to make it wait "window.exe" be activate to continue the script.
What does "activate" mean?

Steffen
by aGerman
15 Sep 2019 05:09
Forum: DOS Batch Forum
Topic: Auto Center Vbs Window
Replies: 3
Views: 123

Re: Auto Center Vbs Window

This is not related to Batch. Not even to any console application. And I get a "Permission Denied" error in line 22. So I can't even run your script. Some hints: "window auto center" You need to calculate the values for window.moveTo(). The screen.availWidth properterty contains the width of the scr...
by aGerman
11 Sep 2019 16:59
Forum: DOS Batch Forum
Topic: ProgramA closes and ProgramB closes automatically
Replies: 3
Views: 146

Re: ProgramA closes and ProgramB closes automatically

I would like that Batch automatically close ProgramB (Syncprogram) before I close ProgramA (Minecraft)
Don't get it. How should a program ever know that a human is about to close A in order to close B programmatically in advance?

Steffen
by aGerman
10 Sep 2019 06:36
Forum: DOS Batch Forum
Topic: Cmd For loop is allergic to certain file names
Replies: 6
Views: 256

Re: Cmd For loop is allergic to certain file names

the for loop starts with the first file (sorted alphabetically by name)
That would have been too easy :lol:
viewtopic.php?f=3&t=8636&p=57237

Steffen
by aGerman
10 Sep 2019 04:50
Forum: DOS Batch Forum
Topic: Cmd For loop is allergic to certain file names
Replies: 6
Views: 256

Re: Cmd For loop is allergic to certain file names

I've looked for three days Seriously? Run DIR /? and FINDSTR /? in a CMD window and you'll get the explanation in your native language. Alternatively scroll up and click the Command Index link in the right side bar. /vrbc: is short for /v /r /b /c: btw. and combining echo and ren in one line looks ...
by aGerman
09 Sep 2019 01:33
Forum: DOS Batch Forum
Topic: Cmd For loop is allergic to certain file names
Replies: 6
Views: 256

Re: Cmd For loop is allergic to certain file names

There are several things in your code that make me wonder that it actually works most of the time. However, I already saw this behavior in simple FOR loops as well as in FOR /D and FOR /R loops. It seems that the list of found files are not buffered internally. It may happen that already renamed fil...
by aGerman
06 Sep 2019 11:16
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 427

Re: retrieving drive details into variables

Code: Select all

WMIC Path Win32_Volume WHERE "DriveLetter='D:'" SET DriveLetter='A:'
That's the Batch command translated from your PS above.
All you have to do is, put it in the loop and use the FOR variable instead of D:

Steffen
by aGerman
05 Sep 2019 09:53
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 427

Re: retrieving drive details into variables

You can process all these information at once @echo off &setlocal for /f tokens^=2^ delims^=^" %%i in ( 'WMIC Path Win32_DiskDrive Assoc /assocclass:Win32_DiskDriveToDiskPartition 2^>nul ^|findstr /c:"Disk #"' ) do for /f tokens^=4^ delims^=^" %%j in ( 'WMIC Path Win32_LogicalDiskToPartition 2^>nul ...
by aGerman
04 Sep 2019 16:41
Forum: DOS Batch Forum
Topic: rename files in a directory in a batch
Replies: 3
Views: 244

Re: rename files in a directory in a batch

You should exactly define the rules. Even your first example is already ambiguous. The name seems to be separated using dashes which divide it into 4 substrings. Are there always 4 substrings? Is the first substring at least 2 characters long and the second always 6? Does always the 4th substring co...
by aGerman
04 Sep 2019 09:55
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 427

Re: retrieving drive details into variables

What I meant is something like that: for /f "tokens=2 delims==:" %%i in ('wmic logicaldisk where "drivetype=5" get DeviceID /value') do ( echo work with %%i here, rather than just echo-ing the drive letter as in this example line ) There are a couple of example powershell scripts I've come across It...
by aGerman
03 Sep 2019 15:43
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 427

Re: retrieving drive details into variables

Unfortunately I don't have optical drives on any machine I have access to. Don't have a use for them anymore. Maybe there is a possibility using WMI. But that's something I have to search in the internet, too. I want to get each drive once. Processs them once. But that's exactly what you get in the ...