I write a lot of documentation and often have to type long framework file name paths, which is tedious.
I wanted a quick way of copying file names or other information to the clipboard. Surprisingly, it wasn't easy. I tried a variety of methods such as various script languages and Windows clip.exe, none of which gave a good result. All either required script files, didn't support copying to the clipboard, prompted for something, or didn't copy to the clipboard in an ideal format so I had to further edit.
I came up with the powershell script which gives a good result:
powershell -NoProfile -Command "& { Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Clipboard]::SetText('@RelFName@') }" |
The @RelFName@ is the relative path and filename, which is exactly what I wanted. There might be other useful PhpED replacement variables.
To make this available on the filename tabs with a right-click I did this:
*
Tools > Settings > Integration
*
Add Menu and give it a name. I used 'Copy file path to clipboard'.
* Choose execute with
Shell and enter the powershell command line
* Further down the options, tick
Show this command in File Bar popup
* Click
Close
Done! You can now right-click file tabs and copy the name to your clipboard.
The powershell window flashes up. Don't bother trying to stop that happening; you can't. Whilst powershell does support minimized and hidden windows, it always first flashes up the window.