Search found 5 matches
- 2022-May-13, 11:21 am
- Forum: Windows CMD Shell
- Topic: position variables in substring extraction use octal number recognition
- Replies: 1
- Views: 76
Re: position variables in substring extraction use octal number recognition
Interesting, don't remember noticing that before ... but doesn't altogether come as a surprise, given that other numeric handling interprets octal. S:\>if 8 EQU 010 echo hello octal hello octal S:\>set /a x=010 8 Good to know for potential gotchas though! There is, however, an interesting divergence...
- 2022-Apr-14, 8:45 am
- Forum: Windows CMD Shell
- Topic: How to differentiate between similar filename extensions?
- Replies: 6
- Views: 383
Re: How to differentiate between similar filename extensions?
Maybe something like this?
This should count all the extensions, if you only care about a few you can just pick those up like %EXT.jpe%
Code: Select all
for %%F in (*) do set /a "EXT%%~xF+=1"
set EXT.
- 2022-Apr-12, 3:36 pm
- Forum: Windows CMD Shell
- Topic: How to differentiate between similar filename extensions?
- Replies: 6
- Views: 383
Re: How to differentiate between similar filename extensions?
I don't think it's treating it as a wildcard exactly, I think you're probably coming up against weirdness from 8.3 filenames S:\>dir /x <snip> 12/04/2022 16:32 2 hello.jpe 12/04/2022 16:32 2 HELLO~1.JPE hello.jpeg 12/04/2022 16:32 2 hello.txt 12/04/2022 16:32 2 HELLO~1.TXT hello.txt1 12/04/2022 16:3...
- 2021-Sep-06, 7:16 am
- Forum: Windows CMD Shell
- Topic: How to create a variable with arguments starting at 2 positions ?
- Replies: 4
- Views: 3647
Re: How to create a variable with arguments starting at 2 positions ?
I agree, it feels like there should be a more elegant solution -- but keeping it robust is tricky without knowing more about the expected input. The only other thing I had in mind was a FOR loop, but it doesn't look any better to me (while probably being marginally worse on performance due to the re...
- 2021-Sep-03, 11:21 am
- Forum: Windows CMD Shell
- Topic: How to create a variable with arguments starting at 2 positions ?
- Replies: 4
- Views: 3647
Re: How to create a variable with arguments starting at 2 positions ?
SHIFT set arguments=%* I don't think that will work Simon, AFAIK %* always contains all of the original args, regardless of "shift" invocations. You'd probably have to do something like this: @echo off set "args=" call :argloop %* set args goto :EOF :argloop shift if "%~1&q...