handling percent signs in filenames

  • Thread starter CSGalloway@nc.rr.com
  • Start date


Take Command 8.02.106 Windows XP [Version 5.1.2600]
Take Command Build 106 Windows XP Build 2600 Service Pack 3
Registered to Charles S. Galloway - 5 System License

I am not sure of how to handle the percent signs in filename - given this short and easy to understand BTM, also attached.

:: 1) send multiple files per email generated from DIR /S
:: 2) file names might have % signs ....
:: 3) if name of folder changes - email and the current folder name is the subject of the email
set nLines=%@lines[twilight.lst]
for /l %line in (0,1,%lines) (
:: setdos /x-35678
set cLine=%@line[twilight.lst,%line]
:: setdos /x0
set cAtt=%cAtt /A %cLine
:: handle different folder name in line from twilight.lst
:: rightmost \ will be significant
set xAt=%@index[%cLine,\,-1]
iff %xAt qt 0 then
set cThisFldr=%@right[-xAt,%cLine]
iff %cThisFldr ne %cCurrFldr then
sendmail %cAtt /D /I1 /P1 /R /S1 /V "TarraAnn85@aol.com" "Robert Cast Pictures" Files are attached
echo Emails: %@eval[%line / 5]
unset cAtt
set cCurrFldr=%cThisFldr
:: end handle....

iff %@eval[%line mod 5] eq 0 then
sendmail %cAtt /D /I1 /P1 /R /S1 /V "TarraAnn85@aol.com" "Robert Cast Pictures" Files are attached
echo Emails: %@eval[%line / 5]
unset cAtt
iff %@eval[%line mod 5] ne 0 then
sendmail %cAtt /D /I1 /P1 /R /S1 /V "TarraAnn85@aol.com" "Robert Cast Pictures" Files are attached
echo Emails: %@eval[%line / 5]
unset cAtt
goto :here
:: sample of twilight.lst
Cast Member Photos\u7u7t.jpg
Cast Member Photos\v.jpg
Cast Member Photos\yhyt.jpg

would generate 3 emails. if there were more than 5 files in any one folder - that would generate more emails...



  • sendlist.btm
    1.7 KB · Views: 74
May 20, 2008
Elkridge, MD, USA
CSGalloway wrote:

> setlocal
> set nLines=%@lines[twilight.lst]
> for /l %line in (0,1,%lines) (
> :: setdos /x-35678
> set cLine=%@line[twilight.lst,%line]

Regardless of the issue of percent % signs, I would recommend recasting this
program using DO:

do cline in @twilight.lst
:: setdos ...
set cAtt=%cAtt /A %cLine

Two separate reasons:
1/ Using DO there is no limit on the number of characters in the code,
unlike the FOR loop using a command group (32767 in the file, 65535 after
variable expansion)
2/ The execution speed reasons described in help topic f_line.htm: to expand
%@line[file,100] all lines from line 0 to line 100 need to be read.
Similar threads
Thread starter Title Forum Replies Date
C handling percent signs in filenames Support 2
vefatica WAD TCC: inconsistent character handling Support 11
M Handling of %~I problem Support 4
J File explorer handling from command line? Support 2
forbin Strange handling of [nonbright] magenta background (v22) Support 2
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
thorntonpg Handling files with embedded spaces Support 1
J junction copy/move handling Support 6
C How to? MOVE and handling out of space Support 2
The Wizard WAD Possible Incorrect COMSPEC handling Support 2
BobK How to? Handling filenames with blanks at command line Support 3
Frank WAD handling variables with $-prefix Support 14
A Discrepancy in handling of "can't copy or move file to itself" Support 4
M How to? A question about error-handling... Support 25
S Description handling Support 3
B Strange handling of a .BAT file Support 5
S Ctrl-C handling while piping Support 0
vefatica Icon handling in b153 Support 7
U An annoying bug with TCC's icon handling in the taskbar Support 25
p.f.moore Bug in plugin break handling? Support 0
p.f.moore Error handling in plugins Support 2
S WAD PDIR: files with percent sign % in name cause not listing other files in directory Support 9
newbie Change percent-sign to anything-else in filename Support 24
S PDIR has trouble processing filenames with embedded percent sign Support 3
Phileosophos Using a percent sign in the PROMPT Support 3

Similar threads