SETLOCAL ... ALIAS ... pipes

May 20, 2008
11,400
99
Syracuse, NY, USA
I use global aliases. If in a BTM, I SETLOCAL and then define an alias, that alias is not known in pipes.

Is that WAD and is there a way around it?
 

rconn

Administrator
Staff member
May 14, 2008
12,345
150
WAD. SETLOCAL switches aliases from global to local, because users were complaining that when they modified an alias inside SETLOCAL it was affecting all of their sessions. Thus far, you're the only one who's *wanted* a change inside SETLOCAL to affect everything.

There is no way to turn that off.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
It's not important. For years the text utils (grep, ...) from the ancient Thompson ToolKit have been in my PATH. They're simple and pretty easy to use and I'm quite accustomed to them. But I also have the (Gnu) UNXUTILS collection of tools which are significantly more powerful. I needed the Gnu utils in a project so I made some aliases to keep coding down. For example, these
Code:
alias gsort `(2>nul g:\gnu\sort.exe %$)`
alias gcut `g:\gnu\cut.exe %$`
alias guniq `g:\gnu\uniq.exe %$`
alias ggrep `g:\gnu\grep.exe %$`
made the likes of this
Code:
gcut -f 3 all.log | gsort -n | guniq -c | gsort -r | head /n %count
easier to code (and easier to read).
I was surprised when it didn't work inside SETLOCAL.

So, a question. If I (finally) move to a 64-bit OS, will things like the above still work with those 32-bit utilities?
 
Similar threads
Thread starter Title Forum Replies Date
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
K seems to have no effec tin CMDebug: SETLOCAL EnableDelayedExpansion Support 1
cgunhouse SETLOCAL not working in BDEBUGGER Support 9
Joe Caverly How to? SETLOCAL Level Support 16
Joe Caverly SETLOCAL removes Aliases and Functions Support 3
rps WAD Setlocal issue Support 4
Charles Dye Read-only environment variables wiped by SETLOCAL / ENDLOCAL Support 5
T Documentation SETARRAY & SETLOCAL/ENDLOCAL Support 8
vefatica Command line SETLOCAL? Support 11
Charles Dye Fixed GPF in SETLOCAL Support 16
M How to? Does the "Do" command effectively do a "SetLocal/EndLocal"??? Support 2
H Help for SETLOCAL in TCMD11 Support 0
D Can alias pass parameters to for command? Support 3
Jay Sage Issue with CD_ENTER Alias Support 37
Jay Sage Issue with CD_LEAVE Alias Support 3
Jay Sage WAD Failure of Alias Command with /Z Option Support 14
R @select inside alias gives different (insanely small) window Support 7
kb6ojs ALIAS with multiple commands? Support 9
vefatica Can I alias @@Ctrl-Shift-Alt-u? Support 4
D Alias with setdos no longer works Support 21
vefatica TPIPE in an alias? Support 2
Peter Murschall TCC V26.01.3x Debugging has problems with Alias /R Support 1
Peter Murschall CMDebug 26.01.37 has problems with Alias Support 21
samintz How to? Alias or prompt? Support 1
MickeyF expand alias in cmdline with Ctrl-F in TCC Support 21
Jay Sage Directory Alias Access to FTP Servers Support 2
rps How to? Shralias and producing history.sav, alias.sav .. Support 6
J Alias @@F5 hotkey Support 2
vefatica alias.sav not accurate Support 8
Joe Caverly Using a Directory Alias with @iniwrite fails Support 14
N multiple command alias and redirection Support 0
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
rps How to? Alias/Command line use of *log on/off Support 2
MickeyF alias terminating before it should Support 3
JohnQSmith ALIAS /R in TCSTART.BTM Support 9
D Alias in batch file Support 3
vefatica Can't execute @ALIAS[...] Support 5
E How to? Load Alias File on Startup Support 3
I Windows 10 console does not allow alt-F4 alias to complete Support 1
MickeyF create an alias with optional parameter Support 4
nickles Alias expansion Support 7
T scrput `` in alias or function Support 2
vefatica Alias works differenltly v16 vs. v17 Support 13
B Alias with multi line definitions not assigned Support 6
jbanaszczyk Alias with space in the name Support 3
jbanaszczyk Alias for internal command Support 8
D Clear alias parameters Support 7
T Fixed multi-line alias issue Support 13
keithg1964 WAD 16.0027 Alias /rz bug Support 8
R In addition to ALIAS /Z and FUNCTION /Z, HISTORY /Z? Support 1

Similar threads