Linux
--
Questions
--
Followers
Top Experts
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
i.e.
set backupshare=\\mycompany-dc
Govvy, can you give an example of how it would work with SETX? For example, how would I alias ls=dir?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
C:\>setx LS DIR /M
ERROR: Access to the registry path is denied.
@dir %*
The %* will pass any command line options to the apps.
If this is Win7 etc. you would need to do it as an admin, e.g. start cmd.exe prompt as admin then:
cd /d c:\windows\system32
echo @DIR %* > ls.cmd
ls

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Didn't work as expected.
C:\>SETX LS DIR /M
SUCCESS: Specified value was saved.
C:\>LS
'LS' is not recognized as an internal or external command,
operable program or batch file.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Yeah, that's what it seems to me. And what I'm trying to do is just use aliases that can be stored for future use.
Steve

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
u ls
so you have u.cmd whcih takes first param as shortcut etc...
but easier then to type dir!
HKEY_LOCAL_MACHINE\SOFTWAR
or here
[HKEY_LOCAL_MACHINE\SOFTWA
@="c:\\window\\system32\\c
and ls.exe will launch cmd.exe, like in the same way that if you run "write.exe" it runs wordpad for you.... BUT I haven;t been able to add any command line arguments, and you'd have to do:
cmd /c dir
Steve
@echo off
doskey /macrofile=c:\somepath\dos
cmd /k
doskey-macro.txt contains
ls=dir
etc.
You can amend registry entries so that a batch autoruns when launching a cmd.exe session or just use a shortcut to this batch to start yourself a cmd windows with them in place.
Alternatively if you haven't looked at it in the link given by fanranj above it shows similar where doskey is added to the autorun key I mention above and an alias defined of "alias". Therefore you can add aliases in the same way as you are used to with unix shells... clever stuff!
Haven't had a chance to try it like this but looks like it could be useful.
Steve






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
This is following the path:
"HKEY_CURRENT_USER\Softwar
Value name is "AutoRun"
Value of it is "C:\somedir\yourscript.cmd
And then in yourscript.cmd either
@doskey /macrofile=c:\somepath\dos
and then list all your macros in doskey-macro.txt
or list them all one by one:
@echo off
doskey ls=dir
doskey cat=type
etc.
cat / ls / grep is about the limit of my unix shell usage so make the rest up yourself :-)
This looks exactly like what I want! So, I understand the "Save" part...but it doesn't look like I need to type "LOAD" to use the aliases. When would I use that?

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Have enabled this in my own cmd prompt now too - had seen technique befoe but not as neat as with making an alias alias!
Steve






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Linux
--
Questions
--
Followers
Top Experts
Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.