@execstr[] on Win10

Aug 30, 2016
3
0
#1
Seems that @execstr[] behaves differently on Win10 than on earlier versions.
I have the following alias:
alias du=`*echo %@word[" ",0-7,%@execstr[-2,*dir/suk %1]]`

This prints something like ".... bytes in ... files and ... dirs" on Win 7 and "ECHO is OFF" on Win10.

Drilling deeper, the negative line number in @execstr[] doesn't work. No matter which negative number I specify in "echo %@execstr[n,dir]", I get "ECHO is OFF".

I am sing 20.00.16. Same results seen with build 15. (Actually, tested b15 and b16 on Win10, and b14 and b16 on Win7). Windows 7 and 10 are Pros.

Ideas? Thanks
 
#2
I'm using Win 10 and I get the same "ECHO is OFF" result you report. I was able to get output such as:

977,616,161 bytes in 175 files and 74 dirs

via:

dir /s /k /u2 | echo %@word[" ",0-7,%@line[con:,2]]

... and was able to make an alias out of it. I'm assuming that's the kind of output you're after.

The "2" argument for switch "u" prints just the summary, like so:


<first line of output is blank>
Total for: D:\directoryname\*
977,616,161 bytes in 175 files and 74 dirs 977,960,960 bytes allocated
485,612,150,784 bytes free


Side-issue... as I understand it, these days the recommended practice with "dir" and other commands is to separate the switches rather than ganging them up (as in "/sku") — though I can't remember at the moment why the separation is recommended.
 
Aug 30, 2016
3
0
#3
Great, thanks!
This solves my alias issue.
I'm still going to use @execstr[] because pipes invoke secondary shells, but now I can use a positive number, which works.

The question about @execstr[] still remains, however: negative numbers don't work as they used to.
 
#5
TCC 19 x64 on Win 10 Pro x64 here, and your alias works fine:
6,426,949,939 bytes in 4,288 files and 2,888 dirs

For years, I've been using:
alias dirtree=*dir /a: /su2, yielding:
Volume in drive . . .

Total for: . . .
6,427,100,023 bytes in 4,297 files and 2,888 dirs 6,476,431,360 bytes allocated
88,818,302,976 bytes free

Adding /a: to your alias also yielded:
6,427,100,023 bytes in 4,297 files and 2,888 dirs

So thanks for the alias; it will get added to my list.
 
Aug 30, 2016
3
0
#6
Not reproducible here -- I get this format with your alias:

[...deleted text...]

DIR in TCC doesn't know or care what version of Windows is running.
Thanks for checking, however the problem was not in DIR but in @execstr[].
As I posted, using a negative number for the line number resulted in "ECHO is OFF".
I tried "echo %@execstr[-2,dir]" and got "echo is off".

HOWEVER: it works fine right now! Why? It's still the same build..
MikeA saw the same "echo is off". I wonder if that's fixed for him now, too.

Strange.