How do I create a command on Windows without having to create a file?
I want to create the command hello without having to create a file
You can use doskey
.
Open a cmd shell
Enter the following command:
doskey hello=echo Hello world!
Run the command:
hello
Example:
F:\test>doskey hello=echo Hello world!
F:\test>hello
Hello world!
F:\test>
Further Reading
- doskey - Recall and edit commands at the DOS prompt, and create macros. You cannot run a Doskey macro from a batch file.
You can create an Environment variable, and then call it using %hello%