Search found 4506 matches

by aGerman
23 Oct 2022 04:09
Forum: DOS Batch Forum
Topic: Backup Batch File
Replies: 15
Views: 5702

Re: Backup Batch File

I have no idea how it comes that you appended the date twice. This doesn't fit to the code you posted.

FWIW I left out any options for the ROBOCOPY command because you know best what you want to do. However, you might want to add at least option /s
by aGerman
23 Oct 2022 04:03
Forum: DOS Batch Forum
Topic: Batch file to copy a file to desktop
Replies: 2
Views: 1714

Re: Batch file to copy a file to desktop

The command for copying a file is COPY.

Code: Select all

copy "source" "destination"
... where source and destination have to be customized.

Steffen
by aGerman
23 Oct 2022 03:58
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97522

Re: infinite loop with break condition

Yeah, that's significantly faster! 11:48:21,98 short code 11:48:26,01 long code 11:48:33,41 einstein code 11:48:35,04 Drücken Sie eine beliebige Taste . . . In the first place I had some difficulties to read the code in my editor. Then I recognized the mix of spaces and tabs for indentations is the ...
by aGerman
22 Oct 2022 13:58
Forum: DOS Batch Forum
Topic: Backup Batch File
Replies: 15
Views: 5702

Re: Backup Batch File

In your initial post the target is "C:\Users\john.smith\Desktop\BACKUPS\ACCESS BACKEND BACKUP" where my understanding has been that "ACCESS BACKEND BACKUP" should get the date suffix, like "ACCESS BACKEND BACKUP 10-22-2022"- The code I wrote would rename "ACCESS BACKEND BACKUP 10-22-2022" to "ACCESS...
by aGerman
22 Oct 2022 08:37
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97522

Re: infinite loop with break condition

do you have a sample txt to test? just in case let's move on to that thread. Sure I have. test.zip Result: 16:23:32,14 short code 16:23:36,15 long code 16:23:43,84 Drücken Sie eine beliebige Taste . . . but if you optimize it well Haha, this is a comparison of apples and oranges now. Of course you ...
by aGerman
22 Oct 2022 07:06
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97522

Re: infinite loop with break condition

this take 3 second on my pc
~10s for me :lol:
It's just a slow little netbook in my case.
the long code trasformed in while..do on my machine take 4 second
~15 s.
It takes ~11s if all empty lines are removed. Even empty lines count whenever you have to jump to a label.
by aGerman
22 Oct 2022 06:11
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97522

Re: infinite loop with break condition

And for not making it too easy, the distance between the label and GOTO seems to matter as well. Again 5 lines but the SET /A in a separate line makes it take ~8 seconds. @echo off &setlocal EnableDelayedExpansion &set "n=0" &echo %time% :loop set /a "n+=1" if !n! leq 10000 goto loop echo %time% %n%...
by aGerman
22 Oct 2022 05:55
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97522

Re: infinite loop with break condition

These 5 lines take ~5 seconds on my machine @echo off &setlocal EnableDelayedExpansion set "n=0" &echo %time% :loop set /a "n+=1" &if !n! leq 10000 goto loop echo %time% %n% &pause The same code but 12 lines take ~11 seconds on my machine @echo off setlocal EnableDelayedExpansion set "n=0" echo %tim...
by aGerman
22 Oct 2022 05:42
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97522

Re: infinite loop with break condition

Currently the last line in your code is GOTO :EOF, right? Now just continue with 10000 more lines. The content of those lines doesn't matter at all because they are never executed. It just increases the number of lines in your file. This is good enough to demonstrate the behavior of GOTO searching e...
by aGerman
22 Oct 2022 05:22
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97522

Re: infinite loop with break condition

Well, actually just add 10000 REM FOO lines as I said. You may finally come up with the observation that moving your loops into another script file might be good in terms of performance ¯\_(ツ)_/¯ I don't know. My assumption is that you won't find the one and only solution which performs best in ever...
by aGerman
22 Oct 2022 05:02
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 97522

Re: infinite loop with break condition

There are a lot of dependencies and it's not easy to choose the right approach. GOTO, for example, is known to first search downward in your code to find the label. If it didn't find the label, it begins again in the first line searching downward. Thus, the time it takes to find the label is quite r...
by aGerman
21 Oct 2022 13:26
Forum: DOS Batch Forum
Topic: Backup Batch File
Replies: 15
Views: 5702

Re: Backup Batch File

In the latest post I wrote a piece of code that should work out of the box, right? And I included some comments in the code to explain what it is all about. I'm sure you already carefully read the code and the comments and tried to understand how it works. Just get back to me if you still have some ...
by aGerman
21 Oct 2022 09:04
Forum: DOS Batch Forum
Topic: Backup Batch File
Replies: 15
Views: 5702

Re: Backup Batch File

I mean, what I've been telling you with the previous code was just how to get and assemble the date string. Of course you need to merge it with your work code :lol: @echo off &setlocal :: Source folder. set "src=G:\ACCESS FRONTEND UPDATER\ACCESS BACKEND" :: This part of the destination path doesn't ...
by aGerman
20 Oct 2022 10:09
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 57875

Re: Complete control of cmd windows

Win 10 and 11 still ship with "Windows PowerShell" (powershell.exe, ver. 5.1). However, Microsoft continues the development of PowerShell in the open source project "PowerShell Core" (pwsh.exe, currently ver. 7.2.6). While "Windows PowerShell" is known to behave unpredictable in a UTF-8 environment,...
by aGerman
20 Oct 2022 09:51
Forum: DOS Batch Forum
Topic: How to parse and extract data from string with jrepl
Replies: 6
Views: 2626

Re: How to parse and extract data from string with jrepl

Like Antonio, I also assume that a quotation mark is missing somewhere because they are unbalanced. Unbalanced quotes lead to errors, so I added one. @echo off set "myvar=000006,1666026219,"2022/10/17","19:03:39","172.24.48.245","XYZ","audit","info","Oct 17 08:18:49 SND1 Group: CC224010 - POE: SND10...