Pcgamer27

Member
Joined
Mar 1, 2025
Messages
65
i am looking for a script that copy certain folder to other location

Sources folder Sounds

destination folder
C:\Windows\Media folder
 

Solution
Certainly! Here is a PowerShell script you can run as Administrator to copy a folder named Sounds from your Sources directory (assuming it's next to the script or at a known path) into C:\Windows\Media:

PowerShell Script: Copy Sounds Folder to Windows Media

Code:
# Define source and destination paths (edit as needed)
$sourceFolder = "C:\Path\To\Sources\Sounds"          # <-- Change to your actual path
$destinationFolder = "C:\Windows\Media\Sounds"

# Create destination folder if it doesn't exist
if (!(Test-Path -Path $destinationFolder)) {
    New-Item -Path $destinationFolder -ItemType Directory -Force
}

# Copy all content, recursive, overwrite existing files
Copy-Item -Path...
Certainly! Here is a PowerShell script you can run as Administrator to copy a folder named Sounds from your Sources directory (assuming it's next to the script or at a known path) into C:\Windows\Media:

PowerShell Script: Copy Sounds Folder to Windows Media

Code:
# Define source and destination paths (edit as needed)
$sourceFolder = "C:\Path\To\Sources\Sounds"          # <-- Change to your actual path
$destinationFolder = "C:\Windows\Media\Sounds"

# Create destination folder if it doesn't exist
if (!(Test-Path -Path $destinationFolder)) {
    New-Item -Path $destinationFolder -ItemType Directory -Force
}

# Copy all content, recursive, overwrite existing files
Copy-Item -Path "$sourceFolder\*" -Destination $destinationFolder -Recurse -Force

Write-Host "Sounds copied from $sourceFolder to $destinationFolder"

How to Use

  1. Edit $sourceFolder so it points to the folder containing your sounds (e.g., D:\Sources\Sounds or C:\Users\Tim\Desktop\Sources\Sounds).
  2. Run PowerShell as Administrator! (You need admin rights to write to C:\Windows\Media)
  3. Execute the script.

To call from Command Prompt (using a batch file):

powershell.exe -ExecutionPolicy Bypass -File "C:\Path\To\Script\CopySounds.ps1"

Copy Everything Into C:\Windows\Media

  • If you want just the contents (not the "Sounds" folder) inside C:\Windows\Media, change destination to "C:\Windows\Media".

Example for SetupComplete.cmd or Unattended:

powershell.exe -ExecutionPolicy Bypass -Command "Copy-Item -Path 'C:\Sources\Sounds\*' -Destination 'C:\Windows\Media' -Recurse -Force"
This assumes during deployment your Sources\Sounds folder is at C:\Sources\Sounds.

If you tell me the exact full path to your Sources\Sounds folder (for example, D:\Install\Sources\Sounds), I can paste the one-line command for you!
 

Solution
Back
Top