Search code examples
windowscmddoskey

Copying file path of current directory in CMD(DOSKEY)


I'm writing DOSKEY with multiple commands, separated by $T, and I need to copy PATH of current directory to cipbord(so I could use it latter outside of CMD) and to continue with commands. I have tried chdir | clip by it brakes commands after. Basicly a need copy as path from windows explorer.


Solution

  • If you are storing the command as a DOSKEY macro, then you need to escape any special characters like |. Also, the $T does not seem to work after a pipe, but ^& does work.

    doskey macroName=echo Command1^&cd^|clip^&echo Command2