1

I found this post helpful but could not comment because of missing points.

Create Copy-Path Keyboard Shortcut Windows 10

My question is, how can I disable the surrounding quotes(") from the copied path?

I get something like

"C:\Windows"

but I want to have

C:\Windows

Edit: I wish to use the QuickSetting solution contained in the windows explorer. As described by this answer https://superuser.com/a/1266115/902847

0

2 Answers 2

0

Assuming that you are using Path Copy Copy (as given in the "Accepted" answer to the Super User question you've referenced), simply open the link in the Window's Start Menu to the Path Copy Copy Settings, select the Options tab and make sure that "Add quotes around copied paths" is unchecked:

Path_Copy_Copy_Settings_Screenshot

1
  • Thanks for the suggestion. I can't create a keyboard shortcut in PathCopyCopy, thus I can not accept this as answer.
    – SiGa
    Mar 1, 2019 at 9:33
-1

If you're able to use something like AutoHotkey, try this out in a script.

The code should be fairly self explanatory, but to be clear I'll explain:

It will only be registered when a Windows Explorer window is open. After storing your current clipboard, it sends Shift+AppsKey, which opens the expanded context menu. Then it sends the letter "a", which is the shortcut key in that menu for "Copy as path". Afterward, it restores your previous clipboard and "returns" the value. This value is able to be used separately in any manner you want. Basically, you can store it in a variable, and then use it in another function. For example, using it as a parameter for a Google search. You would need to write the remaining logic for its use in this manner, because simply returning a value and not doing anything with it is meaningless.

At the bottom, the hotkey Shift+Alt+f (Adjustable; read the docs for more info) triggers that function, and displays the result in a message box.

#If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass")

;; Returns the unquoted full-path for the selected file/folder in Windows Explorer
GetUnquotedFullPathFromSelectionInExplorer() {
    local
    clipSaved := ClipboardAll
    Clipboard := ""
    SendInput, +{AppsKey}a
    ClipWait, 3  ; Wait up to three seconds
    if (ErrorLevel && !Clipboard) {
        Clipboard := clipSaved
        MsgBox, Failed to copy path to clipboard
        Return
    }
    fullPath := Clipboard
    Clipboard := clipSaved
    Return Trim(fullPath, """") ; trims any surrounding double quotes
}

;; Makes a popup message box with the unquoted full-path for the selected file/folder
;; in Windows Explorer
+!f:: ; Shift+Alt+f
    MsgBox, % GetUnquotedFullPathFromSelectionInExplorer()
Return

#If

If you'd rather keep the path in your clipboard, it would be even shorter. For example:

#If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass")

;; Updates the clipboard with the unquoted full-path for the selected
;; file/folder in Windows Explorer
+!f:: ; Shift+Alt+f
    Clipboard := ""
    SendInput, +{AppsKey}a
    ClipWait, 3  ; Wait up to three seconds
    if (ErrorLevel && !Clipboard) {
        MsgBox, Failed to copy path to clipboard
        Return
    }
    Clipboard := Trim(Clipboard, """")
Return

#If
1
  • I find your explanation not to be self-explanatory.  What does it mean for your script to “return” a value but not leave it in the clipboard?  Please do not respond in comments; edit your answer to make it clearer and more complete. Apr 8, 2020 at 4:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .