Can I create shorthand names for use inside cmd?

﹥>﹥吖頭↗ 提交于 2019-11-28 13:00:23

问题


Is it possible to make shortcuts so that I can type "cd desk" instead of "cd desktop" to change directory to the desktop? This would only work if desktop is the only folder or file within the current directory that starts with "desk" but I would really like to do this.


回答1:


No, you can't, but you can use the Tab key to complete the correct name. Pressing Tab multiple time cycles through the matching names existing in the current directory.




回答2:


See Doskey /?.

You could do this

doskey cddesk=cd "%userprofile%\desktop"

Then type cddesk.

By putting all your macros in a batch file you can autoload. Of course you could do this with batchfiles too.

From Technical Reference to the Windows 2000 Registry, Microsoft, 2000.

AutoRun

HKCU\Software\Microsoft\Command Processor 

Data type Range Default value

REG_SZ list of commands There is no default value for this entry.

Description

Contains commands which are executed each time you start Cmd.exe.

Also see this batchfile https://pastebin.com/A2qLw8r3 that list special names.

In a command prompt

start shell:desktop

Or in Start - Run (Winkey + R) just

shell:desktop


来源:https://stackoverflow.com/questions/54956072/can-i-create-shorthand-names-for-use-inside-cmd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!