Austin Kargl
Austin Kargl

Reputation: 89

Copy Selected Files to another folder via the Context Menu

I'm trying to copy selected items in a folder and paste them into a different folder via a script shortcut in the context menu.Screenshot of Context Menu
This script is a shortcut to Powershell.exe that calls the .ps1 to execute. Technically, the script works, but it's only copying the file that is actually right-clicked instead of the group of selected files. In the screenshot, if I selected both "Saved Pictures" and "Screenshots", but right-clicked "Saved Pictures", it would only copy "Saved Pictures" even though "Screenshots" is also selected.

Function Collection{

    #Selects the Item's Current Path
    param($SourceFile)

    #Copy the selected file to the Document Collection folder
    Copy-Item $SourceFile -Destination (New-Item "$Env:UserName\My Documents\temp" -Type Directory -Force) -Recurse -Force
}

Collection $args[0]

I guess my main question for you guys is How do I copy all selected files instead of just the file that is clicked?

Upvotes: 2

Views: 185

Answers (1)

sodawillow
sodawillow

Reputation: 13176

Hit the Windows and R key to open the Run dialog, type this and hit Enter :

shell:sendto

You can add a shortcut to your destination folder in the opened system folder to add it to the Send to list

This seems to fit what you want to achieve here.

Source : howtogeek

Upvotes: 1

Related Questions