Occasionally, I have a path in the clipboard that I want to use as the target for a CD (or, more often, a PUSHD). I just cooked up the following .CMD script using WinClip. It uses the
/F
qualifier on the FOR
command to iterate through the stdout of winclip -p
and PUSHD
to what it finds. So what happens, you may ask, if the clipboard contains more than one line? If the paths are fully qualified then you end up in the folder defined by the last line. Otherwise, you end up in the folder defined by the first line and you see a pile of error messages about not being able to find the subsequent folders.
@echo off :: PUSHCLIP.CMD for /f "delims==" %%f in ('winclip -p') do pushd %%fEnjoy! If you want to amplify the script to better handle unforeseen inputs, go right ahead. Share the result here if you feel so inclined.
© Copyright Bruce M. Axtens, 2015
No comments:
Post a Comment