Search found 3955 matches

by aGerman
10 Apr 2021 10:59
Forum: DOS Batch Forum
Topic: Rename all files in all subfolders except some folders
Replies: 2
Views: 57

Re: Rename all files in all subfolders except some folders

You just need a filter. FINDSTR has an option /V for exclusion.

Code: Select all

for /f "delims=" %%G in ('dir /ad /b "MainFolder\*"^|findstr /vxi /c:"folder x" /c:"folder y"') do (
  for /r %%H in ("MainFolder\%%G\*.txt") do REN "%%H" "%%~nH.old"
)
"folder x" and "folder y" are excluded.

Steffen
by aGerman
30 Mar 2021 16:02
Forum: DOS Batch Forum
Topic: read sfc output
Replies: 4
Views: 283

Re: read sfc output

I'm not sure if that is something you can make use of. However, sfc already writes to the cbs.log file. You just have to filter the entries that contain the [SR] tag.
https://docs.microsoft.com/en-us/troubl ... le-entries

Steffen
by aGerman
29 Mar 2021 11:37
Forum: DOS Batch Forum
Topic: Howto: Renaming of files in a folder
Replies: 2
Views: 220

Re: Howto: Renaming of files in a folder

Command line in a cmd prompt:

Code: Select all

for %i in ("[NLRC]*.pdf") do @for /f "tokens=1*" %j in ("%~i") do @ren "%~i" "%~k"
In a Batch script you would have to double all percent signs.

Steffen
by aGerman
24 Mar 2021 11:11
Forum: DOS Batch Forum
Topic: Bat File Copy Problem
Replies: 1
Views: 237

Re: Bat File Copy Problem

Guessing: The new script file is saved with the wrong encoding or wrong file extension. Use the notepad editor that ships with Windows, select the "File"->"Save as" menu item, make sure the encoding is set to "ANSI" and the file type is "all files (*.*)". Explicitly write the filename with extension...
by aGerman
10 Mar 2021 07:00
Forum: DOS Batch Forum
Topic: Find and copy file
Replies: 6
Views: 757

Re: Find and copy file

OK, so I know that I have notepad.exe in C:\Windows, C:\Windows\System32, C:\Windows\SysWOW64, and a couple more subdirectories. @echo off &setlocal for /f "tokens=*" %%i in ('robocopy "C:\." " nul" "notepad.exe" /xd "C:\windows\system32" /l /s /xx /r:1 /w:1 /ns /nc /ndl /np /njh /njs') do echo "%%i...
by aGerman
10 Mar 2021 04:54
Forum: DOS Batch Forum
Topic: Find and copy file
Replies: 6
Views: 757

Re: Find and copy file

https://www.dostips.com/DosCommandIndex.php#ROBOCOPY
/XD dirs [dirs]... :: eXclude Directories matching given names/paths.
Did you try to exclude the path? As you see, according to the manpage it should be supported.

Steffen
by aGerman
09 Mar 2021 12:28
Forum: DOS Batch Forum
Topic: Find and copy file
Replies: 6
Views: 757

Re: Find and copy file

Starting a file search in the root of a drive is usually a bad idea. To answer your question - There is no way that I know of to exclude a directory from searching. You might be able to exclude it from the search results. However that's not the same and will likely be still terribly slow. Steffen ED...
by aGerman
07 Mar 2021 04:45
Forum: DOS Batch Forum
Topic: How to disable the Windows Close button
Replies: 5
Views: 852

Re: How to disable the Windows Close button

We can continue this topic offline if you're interested. I'll send you my e-mail via PM.

Steffen
by aGerman
06 Mar 2021 10:05
Forum: DOS Batch Forum
Topic: How to Batch a prompt to proceed without user intervention
Replies: 2
Views: 613

Re: How to Batch a prompt to proceed without user intervention

Obviously the prompts come from the tool you're using. The only advise I can give you is to read the manpage of this WinCCU32 utility. Maybe there is another command line option to silence it. And maybe there are more command line option to pass the necessary information to the tool in order to avoi...
by aGerman
06 Mar 2021 06:39
Forum: DOS Batch Forum
Topic: How to disable the Windows Close button
Replies: 5
Views: 852

Re: How to disable the Windows Close button

Gerhard, I'm quite sure you can bind a macro to the open forms event. And I would be surprised if it wouldn't be possible to declare and invoke Win32 platform API functions in LibreOffice. Unfortunately I'm not familiar with LibreOffice macros and besides of that it would be off-topic in this forum....
by aGerman
05 Mar 2021 11:09
Forum: DOS Batch Forum
Topic: How to disable the Windows Close button
Replies: 5
Views: 852

Re: How to disable the Windows Close button

Can't be done with pure Batch. Certainly in a PowerShell script or a hybrid. However, I'm wondering if it's your own application if you're talking about "my database forms". If so, it would be likely easier to create a window without close button from the beginning rather than disabling it using an ...
by aGerman
04 Mar 2021 15:18
Forum: DOS Batch Forum
Topic: change a file's name inside a directory problem
Replies: 3
Views: 719

Re: change a file's name inside a directory problem

The second parameter must not contain the path. Only the new file name.

Steffen
by aGerman
04 Mar 2021 15:17
Forum: DOS Batch Forum
Topic: Move all files up one directory
Replies: 2
Views: 624

Re: Move all files up one directory

If I don't miss something, that should do the trick: @echo off for /d %%a in (*) do for /d %%b in ("%%a\*") do for /d %%c in ("%%b\*") do for %%d in ("%%c\*.*") do ECHO move "%%d" "%%b\" PAUSE This doesn't move anything yet, it just prints the command lines to the screen. Remove both ECHO and PAUSE ...
by aGerman
02 Mar 2021 11:03
Forum: DOS Batch Forum
Topic: simple bat file needed
Replies: 2
Views: 679

Re: simple bat file needed

The only tangible question I see in your topic is "is this dooable?", and the answer is yes.

viewtopic.php?f=3&t=6108

Steffen
by aGerman
27 Feb 2021 18:22
Forum: DOS Batch Forum
Topic: [How-To] Parse DateTime strings (PowerShell hybrid)
Replies: 14
Views: 1559

Re: [How-To] Parse DateTime strings (PowerShell hybrid)

dbenham wrote:
25 Feb 2021 15:44
the output always uses the local time zone
This is true now. The 'Z' in the ISO 8601 UTC notation was previously ignored.

Steffen