1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

@execstr[] on Win10

Discussion in 'Support' started by Tom.L, Aug 30, 2016.

  1. Tom.L

    Joined:
    Aug 30, 2016
    Messages:
    3
    Likes Received:
    0
    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. mikea

    Joined:
    Dec 7, 2009
    Messages:
    213
    Likes Received:
    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.
     
  3. Tom.L

    Joined:
    Aug 30, 2016
    Messages:
    3
    Likes Received:
    0
    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.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,032
    Likes Received:
    84
    Not reproducible here -- I get this format with your alias:

    32,804,703 bytes in 77 files and 17 dirs

    in Windows 10 x64 & TCC v20. Changing the line number to -1 returns:

    446,600,548,352 bytes free

    DIR in TCC doesn't know or care what version of Windows is running.
     
  5. Just Another Joe

    Joined:
    Aug 7, 2009
    Messages:
    48
    Likes Received:
    0
    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.
     
  6. Tom.L

    Joined:
    Aug 30, 2016
    Messages:
    3
    Likes Received:
    0
    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.
     

Share This Page