0

Is there a way to create a shortcut (.lnk) file that uses a DOS command line instead of pointing to a file?

It would be great to simply DC a shortcut instead of having to invoke a command line every time I want to do this specific action.

Thanks for your help.

1 Answers1

3

Windows shortcuts can point to any command. If you want to run a "DOS" command, you are probably looking for one of the commands which is part of the cmd program (which also can run batch-files). For running those built-in commands you have to run via cmd, e.g.,

cmd /k dir

but if you want to direct the output of the command to a file, you will have to run that within a batch-file, or in a properly quoted command passed to cmd, e.g.,

cmd /k "dir >\mydirectory"

Keep in mind that the shortcut can be told to run in a particular directory. If you do not specify it, that will be in the system directory.

Further reading: