#1
|
|||
|
|||
vbs to send contents of clipboard to File explorer
This started out as a 'what if' that came from trying to get selected text to be used as a key for regedit. I found a way to do that one but I wondered how hard it would be to use the contents of clipboard for input on other commands
Could it be sent to file explorer as a path to a file? This was a question I ran across but not sure if it would need to be tested before entering. Such as: If 'c:\Somedir\SomeFolder\anotherFolder\' exists then go there. |
#2
|
|||
|
|||
Hi questorfla.
You could do what you are wanting by using the following script: Code:
' BrowseToLocationInClipboard.vbs ' Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") ' Get data from clipboard into variable named: strData strData = crt.Clipboard.Text ' Check to see if a file or folder exists with that name: If objFSO.FileExists(strData) Then objShell.Run "explorer /e,/select," & chr(34) & strData & chr(34) End If If objFSO.FolderExists(strData) Then objShell.Run "explorer /e," & chr(34) & strData & chr(34) End If Thanks JJH |
![]() |
Tags |
vbscript |
Thread Tools | |
Display Modes | Rate This Thread |
|
|