FilenameToClipboard.exe:
using System; using System.Windows.Forms; namespace FilenameToClipboard { static class Program { [STAThread] static void Main(string[] args) { if (args.Length == 0) return; Clipboard.SetText(args[0]); MessageBox.Show("Zwischenablage auf '" + args[0] + "' gesetzt."); } } }
FilenameToClipboard.vbs:
Auch möglich als VbScript, nur langsamer, da VbScript direkt kein Clipboard unterstützt und man hier über eine ActiveX-Instanz des Internet-Explorers erst zur Seite navigieren muss:
Set objArgs = WScript.Arguments if (objArgs.Count=0) then MsgBox "Bitte Parameter angeben": WScript.Quit Set objIE = CreateObject("InternetExplorer.Application") objIE.Navigate("about:blank") objIE.Document.Parentwindow.ClipboardData.SetData "Text", objArgs(0) objIE.Quit: Set objIE = Nothing
FilenameToClipboard.reg (spezielle Aufrufsyntax):
Auch möglich: als Programm, welches auf den Rechtsklick ausgeführt werden soll, eine VBS-Datei nutzen:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\Shell] [HKEY_CLASSES_ROOT\*\Shell\Command] @="Dateiname in Zwischenablage" [HKEY_CLASSES_ROOT\*\Shell\Command\command] @="wscript.exe \"c:\\test.vbs\" \"%L\""
| c:\Test.vbs: |
| Set objArgs = WScript.Arguments if (objArgs.Count=0) then MsgBox "Bitte Parameter angeben": WScript.Quit end if MsgBox "Datei: " & objArgs(0) |