Search found 1064 matches
- 30 Aug 2025 07:40
- Forum: DOS Batch Forum
- Topic: i am looking for a batch command choice.com for WinXP
- Replies: 3
- Views: 179
Re: i am looking for a batch command choice.com for WinXP
You can write and use a separate choice.bat file in XP. This will be executed, when there is no choice.exe file is found. The choice batch file itself can use the xcopy or replace technique to get the input key value. Read key presses via REPLACE - New functions :getKey, :getAnyKey, :getMaskedInput ...
- 22 Aug 2025 03:34
- Forum: DOS Batch Forum
- Topic: strLen boosted
- Replies: 91
- Views: 219463
Re: strLen boosted
Hi, What if we claim (or define) that control characters are not part of a string? Would that be reasonable? IMHO a bad idea, a function should do what it claims. And strlen claims to get the length of a string. Else it should be named strlenButNotControlCharacters. And if a strlen function can't be...
- 13 Aug 2025 06:05
- Forum: DOS Batch Forum
- Topic: Echo ( and ) within a block
- Replies: 2
- Views: 2847
Re: Echo ( and ) within a block
Hi miskox,
simply use delayed expansion, that solves also problems with all other special characters.
simply use delayed expansion, that solves also problems with all other special characters.
Code: Select all
@echo off
setlocal enableDelayedExpansion
set str=somestringABCDEF
(echo/)&&(echo !str!)
set str=somestring(ABCDEF)
(echo/)&&(echo !str!)
- 11 Aug 2025 13:54
- Forum: DOS Batch Forum
- Topic: strLen boosted
- Replies: 91
- Views: 219463
Re: strLen boosted
However what puzzles me is why it even makes any difference if it comes before the caret (or after it, as this seems to work too). It forces the delayed expansion phase to trigger. The delayed expansion phase only have an effect, when at least one exclamation mark is in the line (and it must still ...
- 11 Aug 2025 05:49
- Forum: DOS Batch Forum
- Topic: strLen boosted
- Replies: 91
- Views: 219463
Re: strLen boosted
I have made the creation of the exclamation mark and caret a little shorter, which happens before the macro is created. Code: Select all FOR /F "tokens=1-3" %%! IN ("! ! ^ ^^^! . ^^^^") DO ^ It looks a little strange, but since the first caret disappears in delayed expansion, it can already be used...
- 06 Jul 2025 14:32
- Forum: DOS Batch Forum
- Topic: strLen boosted
- Replies: 91
- Views: 219463
Re: strLen boosted
Hi, nice to see progress here. However, I don't like your style of writing code. It's really unreadable, and the variable names are, at best, ugly. :D So I built it differently, independently of delayed expansion mode, but with a completely different solution. I only copy the text string once at the...
- 24 Feb 2025 23:53
- Forum: DOS Batch Forum
- Topic: Put Desktop to sleep from Laptop
- Replies: 5
- Views: 12046
Re: Put Desktop to sleep from Laptop
If you are using at least windows 10 you could use ssh. Laptop> ssh desktopuser@[DesktopName or DesktopIP] "Desk_Sleep.bat" But you have to enable the ssh server on the desktop Get started with OpenSSH for Windows . Then you need to create an ssh keypair on your laptop Generate new ssh keys in Windo...
- 14 Feb 2025 06:22
- Forum: DOS Batch Forum
- Topic: ok if i ask a DOSbox-X batch, need to read 2nd string
- Replies: 2
- Views: 7135
Re: ok if i ask a DOSbox-X batch, need to read 2nd string
Hi nnnmmm, i need a batch that returns a var ABC 2nd line is an empty line are there batch commands to get the 2nd string ABC? I suppose not, but you could solve it with a trick. Build one config file which contains only the "ABC". Then you can build the spec file before you start the compiler by ec...
- 26 Dec 2024 04:57
- Forum: DOS Batch Forum
- Topic: is there a way to display the list without the quotation marks when ampersands present?
- Replies: 3
- Views: 12225
Re: is there a way to display the list without the quotation marks when ampersands present?
And I learned a new variant for the trick last month, now it's enough to use %%" instead of %%~". FOR /F "tokens=* delims=X" %%^" in ("X") do ( echo %%" Special characters &..|..^..<..> echo %%" Event a closing bracket ) doesn't harm ) It's possible to create a single FOR meta-variable that's empty....
- 21 Oct 2024 02:34
- Forum: DOS Batch Forum
- Topic: Progress bar
- Replies: 6
- Views: 46089
Re: Progress bar
And now my own try of a progress bar. But with the use of 8 different steps per single character. It shows the progress bar in the window and in the title I'm using the unicode characters from U+2588 to U+258F. ▏ ▎ ▍ ▌ ▋ ▊ ▉ █ How it looks depends on the selected font. My best results are with a uni...
- 17 Oct 2024 02:05
- Forum: DOS Batch Forum
- Topic: How to break from a .cmd?
- Replies: 2
- Views: 23018
Re: How to break from a .cmd?
You can use a small function to exit only the current batch :exit-current-batch for /L %%# in (0 1 40) DO ( (goto) 2> NUL call set "_tmp=%%0" call set "_tmp=%%_tmp:~0,1%%" call set "_tmp=%%_tmp::=%%" if defined _tmp ( REM Current Batch entry found exit /b ) ) exit /b Just use CALL :exit-current-batc...
- 16 Oct 2024 10:06
- Forum: DOS Batch Forum
- Topic: help with multilinea macro in not delayed
- Replies: 4
- Views: 46375
Re: help with multilinea macro in not delayed
Is it possible to bypass the endlocal barrier/tunnel inside a call of variables that have LF or in any case the code to create multiline macros? Yes. You can even make it so that it's possible to return the macro to whatever mode it was in before. The :lineReturnTest test enables delayed expansion ...
- 22 Sep 2024 09:36
- Forum: DOS Batch Forum
- Topic: help with multilinea macro in not delayed
- Replies: 4
- Views: 46375
Re: help with multilinea macro in not delayed
Hi einstein1969, I don't see the relation between delayed expansion and line feeds here. Using of line feeds in macros just depends on code blocks. It is essential to use the parenthesis in the macro. rem define a line feed for using in macro definitions (Set $\n=^^^ %= this line is required =% ) se...
- 13 Sep 2024 00:40
- Forum: DOS Batch Forum
- Topic: Observations about the tilde-dollar syntax %~$variable:I
- Replies: 3
- Views: 60248
Re: Observations about the tilde-dollar syntax %~$variable:I
After reading Batch: How to Properly Use CHOICE Inside of CALL Function? The problem was probably a previously set of the errorlevel variable. I was curious whether it is possible to recognize this programmatically. "if defined variableName" doesn't work here, because it's true for pseudovariables, ...
- 12 Sep 2024 11:10
- Forum: DOS Batch Forum
- Topic: scrolling region test
- Replies: 8
- Views: 61422
Re: scrolling region test
Hi,
a bit nitpicking
new functions: :chr, :asc, :asciiMap (Fri Apr 01, 2011 10:34 pm)
I probably developed the ESC, DEL and CR (buffer overflow) technique, but the rest was just a copy and paste.
jeb
a bit nitpicking

new functions: :chr, :asc, :asciiMap (Fri Apr 01, 2011 10:34 pm)
I probably developed the ESC, DEL and CR (buffer overflow) technique, but the rest was just a copy and paste.
jeb