Can I create shorthand names for use inside cmd?

2020-02-16 05:58发布

问题:

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


标签: cmd shortcut