Server 2019 Bug with @execstr?

Dec 4, 2020
Following up on our email thread from a few weeks ago ...

Receiving this error multiple times per day:
Unknown command "&"

I recently upgraded to TCC because TCCLE on Win2019 was throwing an access violation occasionally on the call to %@execstr[c:\windows\system32\inetsrv\appcmd ...]

Looks like this error that TCC is now throwing is on the same call. Is it possible that TCC is experiencing an internal error on Win2019 and it manifests slightly differently than the access violation in TCCLE? I'm only seeing this error on Win2019, same exact code runs fine on Win2008R2 and Win2012R2.

Best, Duane

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
It would probably be helpful to know the full and complete command that failed. And if it's a batch file, post the batch file itself.

Are you by any chance setting your command separator to something other than the ampersand?
Dec 4, 2020
Full batch file attached. Error occurs on line 61.


    1.8 KB · Views: 87

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
I confess I don't understand the problem. Perhaps Rex will chip in.

But I would suggest replacing those multiline FOR loops with DO loops, just on general principles.
Apr 2, 2011
North Carolina, USA
I believe we need the full command and error message, as there is no "&" in the BTM file.
Dec 4, 2020
I believe the "&" is implicitly added when commands inside parenthesis "( )" span multiple lines.

I had emailed Rex about this earlier. Ultimately here's the line that is causing the problem - if I comment this out it always works fine:

set access=%@execstr[c:\windows\system32\inetsrv\appcmd list config "" -section:system.webServer/handlers -text:[path='*.gif'].requireAccess]

On Windows 2008R2 it would occasionally cause an access violation C0000005 on that same line. So I'm thinking that line is causing a similar problem on Window Server 2019 but just shows up with a different error message.
Dec 4, 2020
I realized the info above isn't quite correct. It was TCCLE on Windows Server 2019 that was throwing the access violation (not Win2008R2). So only Server 2019 is having issues, all other O/S's seem fine.


Staff member
May 14, 2008
An @EXECSTR works by redirecting the output of the specified command to a temp file, and then reading the first line of that temp file.

So there's two possible things that could be going wrong here:

1) The command passed to @EXECSTR has a formatting problem (with an extra or bad "&" inserted).
2) The result of the @EXECSTR is a "&" on the first line, and it's actually SET that's complaining.

You can test the first possibility by adding a logging statement before the @execstr call that echos (to a file) the argument list passed to appcmd.exe

You can test the second possibility by enclosing the %@execstr[...] statement in double quotes, so it will be assigned to SET as a literal &.
Dec 4, 2020
Hi Rex, thanks for the info. I just added that to the script and ran it.

For #1 above here's what it shows as the actual arguments to appcmd - there are square brackes, not sure if that matters.
list config "" -section:system.webServer\/handlers -text:[path='*.gif'].requireAccess

For #2 above I've echo'ed out the full results of the command, it is always just 1 line, looks like this:
ERROR ( message:Cannot find requested collection element. )

Not sure if it matters there are parenthesis in the results that command. If I put quotes around the whole @exestr command like this:
set access="%@execstr[appcmd list config "%sitename%" -section:system.webServer/handlers -text:[path='*.%ext%'].requireAccess]"

it appears the assigned variable will have the quotes too, so don't think I want to do that. I did some testing on the TCC command line and that's what I saw with the "set" command.

So no smoking guns that I can tell, unless like I mentioned above it doesn't like square brackets in the argument or parenthesis in the return variable. But seems unlikely, the problem occurs about 10% of the time whereas those arguments are like above 100% of the time.
Dec 4, 2020
Looks like there's an issue with the @exestr on Windows Server 2019. Do you have a VM that you could test with?
Dec 4, 2020
If you add IIS (Internet Information Services) to your VM you should get the appcmd executable. Then call this a couple hundred times:

set myvar=%@execstr[c:\windows\system32\inetsrv\appcmd list config "" -section:system.webServer/handlers -text:[path='*.gif'].requireAccess]

The "" can be altered to the name of any site you add to IIS, or just the name of the default site, "Default Site"
Similar threads
Thread starter Title Forum Replies Date
S Windows Server version not being detected correctly in TCMD 26RC2 Support 9
T Take Command v21 on Windows Server Support 1
Joe Caverly HTTP Server Support 2
rconn News server crash Support 0
fpefpe How to? ftp server Support 9
S Forum Server Migration Support 5
rconn News Take Command Registration Server Migration 12/28 Support 3
vefatica SENDMAIL, command line override SMTP server? Support 2
Charles Dye Attachments: "A server error occurred" Support 3
millardjk How to? Use TCC.EXE on Windows 2008 Server Core? Support 6
R ftp server password required to download pdf help Support 3
A Using SENDMAIL with Exchange Server Support 1
S @SERVER issues Support 1
K Copy Ftp on Server 2008 painfully slow Support 2
S GPF after successfully renaming directories on an ftp server Support 2
vefatica Crash applying new SMTP server Support 7
J Configure SendMail to go through GMAIL as SMTP server Support 10
vefatica Web server? Support 0
Dick Johnson v28 Cosmetic Bug Support 0
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
R strange bug? Support 7
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
R bug _ypixels in BDEBUGGER Support 6
E Fixed Bug with DIR /Z displaying descriptions Support 8
E Text copy bug Support 1
x13 SETARRAY /Z bug Support 6
Gamegod ffind bug with chinese Support 2
Dick Johnson cdd - is this a bug or a feature? Support 7
P "Set" command behavior - a bug? Support 3
nikbackm TCC 20 variable expansion bug Support 6
gentzel Bug launching external commands in 20.11.43 Support 11
R Is this a bug in SETARRAY? Support 2
M Windows Installer bug? Support 4
vefatica @SCRIPT bug persists Support 4
M Little bug, big consequences .. Support 6 Once again the Can't Install bug bites... Support 2
gentzel Fixed dirs +n bug in 20.0.12 x64 Support 2
M Bug in Windows 10, when adding symbol to task bar Support 6
Alpengreis [Bug?] View (V) Prefs Error (TC 18.00.27 x64) Support 4
D WAD Minor Post Installation Bug in V18 Support 1
I Possible Bug: History /n Returns Nothing Support 3
samintz WAD Weird REN bug Support 6
Jay Sage WAD Possible Bug in Batch Parameters Support 7
G Bug? TCC 16.03.55 Console Palette Support 4
S Return of FTP copy bug in 16.02.48 Support 12
S XenForo bug Support 3
D TCMD16 Delete Toolbar Button bug Support 7
keithg1964 WAD 16.0027 Alias /rz bug Support 8
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2
T Documentation @LINE[CON,n] @LINES[CON] not documented (bug?) Support 4

Similar threads