Search found 11 matches

by GeoffVass
27 Sep 2024 16:10
Forum: DOS Batch Forum
Topic: Docs: GOTO Bug Clarification
Replies: 4
Views: 29541

Re: Docs: GOTO Bug Clarification

Agreed, goto is an immediate change of program flow. If you wanted to recast that script to do something and then come back and do something else, use functions:

Code: Select all

@echo off
call :label&echo FOO

goto End

:label
echo BAR
goto :EOF

:End
pause
by GeoffVass
11 Aug 2023 01:53
Forum: DOS Batch Forum
Topic: Trouble with ROBOCOPY - copy files to destination that don't already exist
Replies: 3
Views: 16281

Re: Trouble with ROBOCOPY - copy files to destination that don't already exist

If the source and destination have different file systems, eg NTFS and FAT or NTFS and some NAS running Linux/Samba, the date-stamp granularity is different and so Robocopy will always copy the file again. The remedy is to use /FFT which takes into account the tiny date-stamp differences. Also be ca...
by GeoffVass
22 Jul 2023 01:14
Forum: DOS Batch Forum
Topic: BAT does no start AHK when put in Startup folder of Windows 10 [SOLVED]
Replies: 4
Views: 4658

Re: [SOLVED] BAT does no start AHK when put in Startup folder of Windows 10

In the Start command, the first parameter is the title of the window being spawned, but actually it hardly ever shows up. Nevertheless I find it more reliable to have an actual title, eg

Code: Select all

Start "Title" [Command]
Start "" is unreliable I think.
by GeoffVass
22 Jul 2023 01:11
Forum: DOS Batch Forum
Topic: RoboCopy - Älter ?
Replies: 1
Views: 2335

Re: RoboCopy - Älter ?

Depending on what "over and over" means, one possibility is that the source has a junction point which refers to something in its own parent. So Robocopy just follows forever in a loop. To stop this, use the /XJ switch.
by GeoffVass
29 Jun 2023 02:10
Forum: DOS Batch Forum
Topic: Is there a script to safely delete a file?
Replies: 3
Views: 3653

Re: Is there a script to safely delete a file?

Generally speaking, you can't rely on the idea that writing new data to a file will replace the existing data. A 'file' consists of some metadata such as the name, and a linked list of pointers to clusters on the disk which the file system uses to construct the contents. NTFS is a transactional data...
by GeoffVass
25 May 2023 22:50
Forum: DOS Batch Forum
Topic: Robocopy query
Replies: 3
Views: 3269

Re: Robocopy query

The issue is that NTFS and FAT/FAT32 have timestamps of different accuracy so whenever Robocopy checks the time stamps between the source and the destination, it looks like they're different, whereas all that's happened is the high-resolution time stamp from NTFS has been rounded to the lower-resolu...
by GeoffVass
19 May 2023 19:05
Forum: DOS Batch Forum
Topic: For/in/do question relating to Registry Backup (XP)
Replies: 4
Views: 6863

Re: For/in/do question relating to Registry Backup (XP)

Just on the general topic of registry backup. Microsoft sort of created a problem here since they've never had a simple method to manage registries. On Windows NT 4 there was a tool called rdisk which supposedly made a sort of 'rescue disk' with boot information and a copy of the registry. Never act...
by GeoffVass
09 Dec 2022 21:55
Forum: DOS Batch Forum
Topic: How to move location of user shell folder Documents, Downloads,Pictures,....
Replies: 1
Views: 8175

Re: How to move location of user shell folder Documents, Downloads,Pictures,....

This is two questions, really. In Windows 2000, Microsoft changed the default profiles root from C:\Winnt\Profiles to "C:\Documents and Settings" and the folders were called "My Documents", "My Pictures" etc and then in Vista they changed it to C:\Users with folders called "Documents" and "Pictures"...
by GeoffVass
24 Oct 2022 20:06
Forum: DOS Batch Forum
Topic: How to [automatically] rename a file within a non-specified subfolder? [AKA stopping Opera from autoupdating]
Replies: 6
Views: 14874

Re: How to [automatically] rename a file within a non-specified subfolder? [AKA stopping Opera from autoupdating]

On my system Opera is in Program Files so I wrote this to start at the root:

Code: Select all

forfiles /p c:\ /m opera_autoupdate.exe /s /c "cmd /c ren @path *.old" 2>nul
Otherwise could be:

Code: Select all

forfiles /p "%LocalAppData%" /m opera_autoupdate.exe /s /c "cmd /c ren @path *.old" 2>nul
by GeoffVass
04 Oct 2021 23:28
Forum: DOS Batch Forum
Topic: Funny Windows 11 Non-Glitch
Replies: 7
Views: 8665

Re: Funny Windows 11 Non-Glitch

The glitch is that I should never have used exclamation marks cosmetically. But it used to work, and now doesn't. So either Microsoft has fixed a bug in Windows 11, or introduced one. Anyway I've just removed the exclamation marks. My point is that it's weird to find some changed behavior in CMD.EXE...
by GeoffVass
04 Oct 2021 17:39
Forum: DOS Batch Forum
Topic: Funny Windows 11 Non-Glitch
Replies: 7
Views: 8665

Funny Windows 11 Non-Glitch

Just found one of my scripts broke on Windows 11. I had something like this: SetLocal EnableDelayedExpansion <do some stuff> if defined Result (echo Success) else (echo Failure!!) EndLocal This has always worked, but on Windows 11 it glitches. You can probably guess the !! in the echo command is the...