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
Search found 4506 matches
- 23 Oct 2022 04:09
- Forum: DOS Batch Forum
- Topic: Backup Batch File
- Replies: 15
- Views: 6054
- 23 Oct 2022 04:03
- Forum: DOS Batch Forum
- Topic: Batch file to copy a file to desktop
- Replies: 2
- Views: 1836
Re: Batch file to copy a file to desktop
The command for copying a file is COPY.
... where source and destination have to be customized.
Steffen
Code: Select all
copy "source" "destination"
Steffen
- 23 Oct 2022 03:58
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 115373
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 ...
- 22 Oct 2022 13:58
- Forum: DOS Batch Forum
- Topic: Backup Batch File
- Replies: 15
- Views: 6054
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...
- 22 Oct 2022 08:37
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 115373
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 ...
- 22 Oct 2022 07:06
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 115373
Re: infinite loop with break condition
~10s for methis take 3 second on my pc
It's just a slow little netbook in my case.
~15 s.the long code trasformed in while..do on my machine take 4 second
It takes ~11s if all empty lines are removed. Even empty lines count whenever you have to jump to a label.
- 22 Oct 2022 06:11
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 115373
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%...
- 22 Oct 2022 05:55
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 115373
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...
- 22 Oct 2022 05:42
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 115373
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...
- 22 Oct 2022 05:22
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 115373
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...
- 22 Oct 2022 05:02
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 115373
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...
- 21 Oct 2022 13:26
- Forum: DOS Batch Forum
- Topic: Backup Batch File
- Replies: 15
- Views: 6054
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 ...
- 21 Oct 2022 09:04
- Forum: DOS Batch Forum
- Topic: Backup Batch File
- Replies: 15
- Views: 6054
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 ...
- 20 Oct 2022 10:09
- Forum: DOS Batch Forum
- Topic: Complete control of cmd windows
- Replies: 88
- Views: 66724
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,...
- 20 Oct 2022 09:51
- Forum: DOS Batch Forum
- Topic: How to parse and extract data from string with jrepl
- Replies: 6
- Views: 2850
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...