Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.comp.lang.shell.batch.msdos > #13
| From | Todd Vargo <tlvargo@sbcglobal.netz> |
|---|---|
| Newsgroups | alt.comp.lang.shell.batch.msdos |
| Subject | Re: counting in DOS |
| Date | 2015-07-10 12:59 -0400 |
| Organization | albasani.net |
| Message-ID | <mnotkn$eeq$1@news.albasani.net> (permalink) |
| References | <mn54vs$ok0$1@speranza.aioe.org> <mn5bep$l02$1@news.albasani.net> <mnm204$n8p$1@speranza.aioe.org> <mnmpom$k52$1@news.albasani.net> <559FF5B3.80103@Leyn.eu> |
On 7/10/2015 12:41 PM, Francky Leyn wrote: > On 7/9/2015 11:40 PM, Todd Vargo wrote: >> On 7/9/2015 10:54 AM, Francky Leyn wrote: >>> Hello Todd, >>> >>> The script is now called crop_double.bat : >>> >>> @echo off >>> set "n=1%1" >> >> Creates a variable named "n" and stores the value of %1, prefixed with a >> 1. This is done because some of your file numbers begin with a zero. >> >> So for 041, the value stored is 1041. >> >> >>> set /a n-=1 >> >> The /a switch indicates an mathematical operation, in this case it >> subtracts 1 from the value. Without the leading 1, it would provide >> incorrect results including removal of the leading zero(s). >> >> So the value stored becomes 1040. >> >>> set "n=%n:~1%" >> >> This removes the leading 1, so the value stored becomes 040. > > > Can go a bit more in detail? > Why the 2 % signs? > What means :~ ? Type SET/? at command prompt for extensive help information. > > >>> mkdir "%CD%\02 crop" >>> i_view32 "%CD%\01 src\%1.jpg" /crop=(0,0,1634,2160,0) /convert="%CD%\02 >>> crop\p. %n%.jpg" >>> i_view32 "%CD%\01 src\%1.jpg" /crop=(1634,0,1634,2160,0) >>> /convert="%CD%\02 crop\p. %1.jpg" >>> >>> It does perfecly what I want. >>> >>> If have a jpg file 041.jpg in "01 src", >>> and if type at the prompt: >>> crop_double 041 >>> then 2 jpg files are generated: >>> "02 crop\p. 040.jpg" and >>> "02 crop\p. 041.jpg" >>> >>> However, I would like to understand the set commands. >>> Could you explain in detail what the different set commands do? >>> >>> Best regards, >>> >>> Francky >> >> > -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages)
Back to alt.comp.lang.shell.batch.msdos | Previous | Next — Previous in thread | Find similar
counting in DOS Francky Leyn <Francky@Leyn.eu> - 2015-07-03 07:01 +0200
Re: counting in DOS Todd Vargo <tlvargo@sbcglobal.netz> - 2015-07-03 02:52 -0400
Re: counting in DOS Todd Vargo <tlvargo@sbcglobal.netz> - 2015-07-09 17:40 -0400
Re: counting in DOS Francky Leyn <Francky@Leyn.eu> - 2015-07-10 18:41 +0200
Re: counting in DOS Todd Vargo <tlvargo@sbcglobal.netz> - 2015-07-10 12:59 -0400
csiph-web