Wierd problem wih "for" command...

May 24, 2010
855
0
Northlake, Il
I'm not sure I'm posting this in the right place, but I have a weird problem with the following command:

Code:
For /R G:\ /D %D in (*) Do (Echo %@Right[17,%@Repeat[ ,17]%@Comma[%@FileSize["%D"]]] %@Right[17,%@Repeat[ ,17]%@Comma[%@FileSize[/S "%D"]]] %D) | Sort /+1 >>Z:\G-Drive.txt
The problem? While it mostly works I get a series of messages (129 of them to be exact) that are similar to the following.

TCC: Unknown command "T-SBC-Yahoo!"
TCC: Unknown command "T-Yahoo!"
TCC: Unknown command "Some"
I even get a message stating:

Usage : RENAME [/A:[[-][+]rhsdaecjot] /B /E /I"text" /MD /N[enst] /O:[-]adegnrstu /P /Q /S /T]
old_name... new_name
And, as you can see, there is no "rename" command in the above sequence.

I'll admit that this more academic than anything else, but I would really like to know what's going on here and if there is some way for me to avoid these messages.

TCC 12.01.44 Windows 7 [Version 6.1.7600]
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: mathewsdw
To: ESFabian@zenge.org
Sent: Sunday, 2011. March 6. 19:12
Subject: [Support-t-2654] Wierd problem wih "for" command...

| I'm not sure I'm posting this in the right place, but I have a weird
| problem with the following command:
|
|
| Code:
| For /R G:\ /D %D in (*) Do (Echo %@Right[17,%@Repeat[
| ,17]%@Comma[%@FileSize["%D"]]] %@Right[17,%@Repeat[
| ,17]%@Comma[%@FileSize[/S "%D"]]] %D) | Sort /+1 >>Z:\G-Drive.txt

| The problem? While it mostly works I get a series of messages (129 of
| them to be exact) that are similar to the following.
...

I suspect you have filenames (or directory names) on your G: drive which include your command separator ("compound") character [by default it is the ampersand &], thus the rest of the file name is considered to be a command but it is not a legal command. What could be worse than just the error message if the command is legal and its execution undesirably alters your file system (deletes or modifies files). You need to quote it to eliminate this possibility everywhere.

BTW, the @FILESIZE command can return a size with embedded commas: %@filesize["%d",bc] - you do not need to use the @comma function. If you want the filesize to be right justified in a 17-column field, the simplest way is %@format[17,%@filesize["%d",bc]]. You could just define a function:
function fs17=`%@format[17,%@filesize[%1,bc]]`
and use it to simplify your command.
--
Steve
 
May 24, 2010
855
0
Northlake, Il
---- Original Message ----
From: mathewsdw
To: ESFabian@zenge.org
Sent: Sunday, 2011. March 6. 19:12
Subject: [Support-t-2654] Wierd problem wih "for" command...

| I'm not sure I'm posting this in the right place, but I have a weird
| problem with the following command:
|
|
| Code:
| For /R G:\ /D %D in (*) Do (Echo %@Right[17,%@Repeat[
| ,17]%@Comma[%@FileSize["%D"]]] %@Right[17,%@Repeat[
| ,17]%@Comma[%@FileSize[/S "%D"]]] %D) | Sort /+1 >>Z:\G-Drive.txt

| The problem? While it mostly works I get a series of messages (129 of
| them to be exact) that are similar to the following.
...

I suspect you have filenames (or directory names) on your G: drive which include your command separator ("compound") character [by default it is the ampersand &], thus the rest of the file name is considered to be a command but it is not a legal command. What could be worse than just the error message if the command is legal and its execution undesirably alters your file system (deletes or modifies files). You need to quote it to eliminate this possibility everywhere.

BTW, the @FILESIZE command can return a size with embedded commas: %@filesize["%d",bc] - you do not need to use the @comma function. If you want the filesize to be right justified in a 17-column field, the simplest way is %@format[17,%@filesize["%d",bc]]. You could just define a function:
function fs17=`%@format[17,%@filesize[%1,bc]]`
and use it to simplify your command.
--
Steve

Thank you, Steve, you are, of course, correct. I am careful to NOT make file and directory names that way myself, but files I import from outside sources (the case here) sometimes use those characters and I don't notice.

And thank you again, Steve, I didn't know some of the above and I'll (try to remember to) do it that way in the future. But it really doesn't matter that much because I didn't find it particularly difficult (either to compose or type) to do it the way I did do it.
 
Similar threads
Thread starter Title Forum Replies Date
B Wierd install problem for TCMD 10 Support 4
fishman@panix.com Wierd startup. Support 7
fishman@panix.com V23 cdd /s doing WIERD things. Support 5
Dick Johnson Weird Color Problem Support 8
fishman@panix.com Problem with 27.15 Support 2
M Problem with VSDevCmd.bat in VS 16.7.3 Support 0
R Problem with @INT[ value] in V26 Support 9
M Selecting test "off by one" problem in Take command Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
K_Meinhard Small problem in german IDE 26 Support 3
B Problem with color in nested shells Support 1
Joe Caverly Problem creating and switching to a DESKTOP Support 9
vefatica Another popup problem Support 10
Alpengreis ffind dialog (/W) problem Support 4
Alpengreis [TCMD v25.00.24] Small space problem with the DE translation in Prefs-GUI Support 1
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
A Problem with functions @int @decimal and identifying Powershell as a shell. Support 12
B IF command problem in tcexit.btm Support 9
fishman@panix.com Problem at Startup of TCC Support 3
P Problem with SFTP copies Support 7
P Problem with FTP copies Support 10
Jay Sage Problem with Context Menu Copy+Paste+Run Key Assignment Support 7
R Problem with %_do_loop in nested do loops Support 2
fishman@panix.com New Problem with later Windows 10 Support 10
Peter Murschall A little problem with LEAVE and COMMENT Support 5
M Handling of %~I problem Support 4
WinLanEm FOR problem Support 18
K Problem With SCRPUT /u Support 3
vefatica What's TCMD's problem with ^e[0m? Support 13
Peter Murschall IDE: RTL with non-English resources-problem is back in Build 28 Support 4
rps Regex problem: \xnn not recognized as a hex character Support 0
rps PRIORITY LOW problem Support 1
old coot Regex problem: \xnn not recognized as a hex character Support 12
vefatica Another problem with build 22. Support 3
Alpengreis [23.x] Download-Problem Support 2
S Problem with " Support 3
C Problem navigating forums Support 11
x13 Problem listing repository files using DIR http(s)://... Support 8
Joe Caverly Problem with TEE in v22 Support 2
Alpengreis Problem with thousands delimiter and colors Support 17
M Take Command 18, migrating to another machine, license problem. Support 1
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
rps How to? @search problem Support 2
WinLanEm @SELECT problem Support 6
T Fixed Problem with use of Batch parameters in the IDE Support 1
Oz Solomon Problem with "list" Support 14
S V21.24 theme problem Support 2
Alpengreis Problem if command prompt is not legacy Support 4
Alpengreis TCMD.INI: The "super hidden" problem ... Support 6
G Odd problem - screen brightness Support 4

Similar threads