Windows 8.1 move selected files in active explorer to anywhere?

roteg

New Member
Joined
May 6, 2015
Messages
1
hello,
I need the simplest way to check if a file explorer window is active and move the selected files/folders in there to a specified temp folder. Any programming/scripting language will be fine.
thanks.
 


Solution
To check if a File Explorer window is active and move the selected files/folders to a specified temporary folder, you can achieve this with a scripting language like PowerShell. Below is an outline of the steps you can take to create a PowerShell script for this task:
1. Get Active Window:
- You can use the Get-Process and Get-Window cmdlets to identify the active File Explorer window.
2. Get Selected Items:
- Use PowerShell to get the selected files/folders in the active Explorer window. This would involve accessing the Windows Shell object to retrieve selected items.
3. Move Items:
- Once you have identified the selected files/folders, move them to the specified temporary folder using...
To check if a File Explorer window is active and move the selected files/folders to a specified temporary folder, you can achieve this with a scripting language like PowerShell. Below is an outline of the steps you can take to create a PowerShell script for this task:
1. Get Active Window:
- You can use the Get-Process and Get-Window cmdlets to identify the active File Explorer window.
2. Get Selected Items:
- Use PowerShell to get the selected files/folders in the active Explorer window. This would involve accessing the Windows Shell object to retrieve selected items.
3. Move Items:
- Once you have identified the selected files/folders, move them to the specified temporary folder using Move-Item cmdlet.
Here is a basic template for a PowerShell script that accomplishes this task:
Code:
# Get active File Explorer window
$window = Get-Process | Where-Object { $_.MainWindowTitle -match "File Explorer" }
if ($window) {
    # Access selected items in the active window
    $shell = New-Object -ComObject "Shell.Application"
    $selectedItems = $shell.Windows() | Where-Object { $_.HWND -eq $window.MainWindowHandle } | ForEach-Object { $_.Document.SelectedItems() }
    # Specify the destination folder
    $destinationFolder = "C:\Temp"
    # Move selected items to the temporary folder
    foreach ($item in $selectedItems) {
        $item.InvokeVerb("copy")
        Move-Item -Path $item.Path -Destination $destinationFolder
    }
}
else {
    Write-Host "No active File Explorer window found."
}
This script provides a starting point and may need additional customization based on your specific requirements and environment. Run this script in the PowerShell console or save it to a .ps1 file for execution. Test thoroughly to ensure it meets your needs.
Feel free to adapt this script further or let me know if you need any more specific modifications or assistance.
 


Solution
Back
Top