Search found 222 matches
- 01 May 2024 05:03
- Forum: DOS Batch Forum
- Topic: Need help copying a line of text from a file to another (without mangling it) :AppendFileLineToFile
- Replies: 8
- Views: 2422
Re: Need help copying a line of text from a file to another (without mangling it) :AppendFileLineToFile
Hi Shodan, There should indeed be a terminating endLocal somewhere after the end of the for /f loop. Delayed expansion is explicitly disabled to prevent any ^ and ! characters in the line of input from being corrupted. But once the line has been read into the variable, delayed expansion can be safel...
- 29 Apr 2024 14:01
- Forum: DOS Batch Forum
- Topic: Need help copying a line of text from a file to another (without mangling it) :AppendFileLineToFile
- Replies: 8
- Views: 2422
- 22 Apr 2024 13:44
- Forum: DOS Batch Forum
- Topic: Need help copying a line of text from a file to another (without mangling it) :AppendFileLineToFile
- Replies: 8
- Views: 2422
Re: Need help copying a line of text from a file to another (without mangling it) :AppendFileLineToFile
Hi Shodan,
I’m not sure what you’re trying to accomplish, but I suggest you read Calling Functions from a Library, especially Post #4 by Penpen.
HTH!
- SB
I’m not sure what you’re trying to accomplish, but I suggest you read Calling Functions from a Library, especially Post #4 by Penpen.
HTH!
- SB
- 10 Apr 2024 14:59
- Forum: DOS Batch Forum
- Topic: check file contains only printable 7-bit ASCII characters
- Replies: 0
- Views: 3965
check file contains only printable 7-bit ASCII characters
Hello All! :) A little proof-of-concept program I put together: @echo off & setLocal enableExtensions disableDelayedExpansion (call;) %= sets errorLevel to 0 =% for /f "tokens=*" %%A in ('chcp') do for %%B in (%%A) do set "cp=%%~nB" mode con cp select=437 >nul ((for /l %%I in (1 1 70) do pause) >nul...
- 10 Apr 2024 08:16
- Forum: DOS Batch Forum
- Topic: How to dynamically escape % symbols?
- Replies: 4
- Views: 758
- 08 Apr 2024 13:34
- Forum: DOS Batch Forum
- Topic: Success or failure echo
- Replies: 3
- Views: 612
Re: Success or failure echo
Hi Squashman! I didn’t know that about robocopy. Good to know, thanks! 8) Gussy, don’t use the "command && success || failure" syntax with robocopy. Follow the example on the SS64 web page referenced by Squashman. Make sure you start with the highest errorLevel and work your way down to the lowest. ...
- 08 Apr 2024 08:34
- Forum: DOS Batch Forum
- Topic: Success or failure echo
- Replies: 3
- Views: 612
Re: Success or failure echo
Hi Gussy! :) If a command executes successfully, it sets errorLevel to 0, a non-zero integer otherwise. There’s an easy way to test for this and to take appropriate action. The syntax goes a little something like this: command && ( success ) || ( failure ) So, your code example would be rewritten as...
- 31 Dec 2023 13:44
- Forum: DOS Batch Forum
- Topic: Split string to characters
- Replies: 32
- Views: 44349
Re: Split string to characters
Hi Again! :) I updated my split string to characters code based on Jeb’s nested for loops technique : @echo off & setLocal enableExtensions disableDelayedExpansion set "hex=0 1 2 3 4 5 6 7 8 9 A B C D E F" set str="!%%^&*~|<>?" set "chr=" & set "N=0" setLocal enableDelayedExpansion if not defined st...
- 30 Dec 2023 10:34
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 116200
Re: infinite loop with break condition
Hi Jeb! :) You wrote: The trick is to nest multiple FOR-Loops, each with a low counting number, like FOR /L %%# in (1 1 16) do ( FOR /L %%# in (1 1 16) do ( FOR /L %%# in (1 1 16) do ( FOR /L %%# in (1 1 16) do ( ... the loop code is here REM Stop the code by goto :break ) ) ) ) :break Obviously thi...
- 27 Apr 2023 05:18
- Forum: DOS Batch Forum
- Topic: Need Help w Batch Rename
- Replies: 1
- Views: 1586
Re: Need Help w Batch Rename
Hi Mike!
Please read the following posts:
HTH!
- SB
Please read the following posts:
- How does the Windows rename command interpret wildcards? (Super User)
- JREN.BAT v2.8 - Rename files/folders using regular expressions (DosTips)
HTH!
- SB
- 25 Feb 2023 08:47
- Forum: DOS Batch Forum
- Topic: Check File Size Properties
- Replies: 12
- Views: 4387
- 20 Feb 2023 11:51
- Forum: DOS Batch Forum
- Topic: Is there a way to pass multiple param value pairs to a batch file
- Replies: 3
- Views: 7465
- 19 Feb 2023 17:20
- Forum: DOS Batch Forum
- Topic: creating a batch file to pause for user input to open a specific folder in windows...
- Replies: 2
- Views: 1981
Re: creating a batch file to pause for user input to open a specific folder in windows...
Hi Gizibo!
Please read this post (#32) by Aacini.
Once you have the folder chosen by the user stored in a variable (eg, %folderName%), you can open a File Explorer window at that location by doing the following:
HTH!
- SB
Please read this post (#32) by Aacini.
Once you have the folder chosen by the user stored in a variable (eg, %folderName%), you can open a File Explorer window at that location by doing the following:
Code: Select all
start "" "%folderName%"
- SB
- 30 Oct 2022 06:31
- Forum: DOS Batch Forum
- Topic: reverse string without goto
- Replies: 10
- Views: 14532
Re: reverse string without goto
Hi Again! :) Belated thanks to Aacini and T3RRY for their excellent contributions. Below is my final word on the topic—a Batch/JScript hybrid: @if (@X==@Y) @then :: Batch @echo off & setLocal enableExtensions disableDelayedExpansion set ^"strFwd=short ^" ^< %% ^| ^^ ! string^" set "strRev=" & for /f...
- 13 Oct 2022 15:43
- Forum: DOS Batch Forum
- Topic: OT: WhatsApp Woes
- Replies: 0
- Views: 31343
OT: WhatsApp Woes
Hello All! :) Forgive me for going off topic, but I’m in a bind. I accidentally deleted 3 weeks worth of WhatsApp messages and media, and I want them restored. No WhatsApp or iCloud backup, nada. :oops: I tried something called Phone Rescue. It could show me the deleted messages. So they are still o...