"start /affinity=<mask>", but cmd.exe doesn't use the "="

MPB

Mar 3, 2016
19
1
52
I was recently testing out a batch file that was written for cmd, and trying to add some TCC fanciness around it to make it work a little better.

In essence, the script will launch a program and it's assigning affinity and node to each one so they run on their own core.

The unusual thing started out because cmd.exe expects an argument like "/affinity 4 /node 1", but TCC expects an equal sign after affinity, so just for a TCC batch, I have to change it to "/affinity=4 /node 1"

It's also confusing because at first I thought that if affinity needed an equal sign, well, node must also, but nope. :) The documentation does indicate the correct syntax, it's just oddly inconsistent, and especially inconsistent with cmd.exe syntax, requiring that equals sign.

Maybe it's not a huge deal, and if I go further and migrate this to a purely tcc solution, there are plenty of other things that would make this a "tcc only" batch file (should probably rename it to a btm).

I just wondered if this was by design or oversight, and is it a big deal? Anyone else have problems with it? In my case it especially comes up if I'm in a tcc shell anyway and just wanted to test out the original, I'd get errors without that "=" in there, so even if I just wanted to run it as-is, I couldn't. And I can't fix it for tcc because the other admin on the system just uses plain cmd.

Thoughts? Is it worth bugging Rex to see if he can make that "=" optional in future builds so it's cmd.exe compatible?
 
  • Like
Reactions: Alpengreis

MPB

Mar 3, 2016
19
1
52
Well, that's one way to do it I suppose. I'm sure I'll forget at times when I'm in TCC doing things and just want to kick something off ad-hoc. That's when the CMD compatibility issues show up.

Anyway, it's a minor quibble, but I do like it when built-in commands between cmd and tcc have the same arguments, even when tcc adds extra ones.

A similar example is the built-in TCC command "tasklist", compared to the standard "tasklist.exe" that comes with Windows. Similar, but different. At least in that case I've just modified my batch files to specifically use "tasklist.exe" if that's the syntax I want to use. In the past I've also made exceptions for the built in "zip" command when I was using an external "zip.exe" for some batch processing of files.

I don't care about those so much, where the TCC command is the same as an external program. It's when it's the same as the built in cmd commands that the problems arise because there's no good way around it. Well, I guess I could add in some features to detect if it's running in tcc or not, with something like:
if %_tccver GTR 0 (<do it the tcc way>) else (<do it the cmd way>)

Or something like this to make it a little more granular:
set affinity=/affinity=40
if %_tccver GTR 0 set affinity=/affinity 40
start "My program" c:\myprogram.exe %affinity%
 

Similar threads