Useful "Set As Wallpaper (Stretched)" PowerShell Script for Custom Context Menu Integration. This script enhances the context menu to reliably set an image as wallpaper in "Stretched" mode, circumventing limitations in MC (MultiCommander) where the "Set As Background Image" option is unavailable—particularly in Flat View. By adding this as a custom context menu item (configured via Config > "Custom Context Menu"), users can consistently apply wallpapers regardless of MC's view mode.
Implementation Details:
Update the $ScriptFilePath variable in the script with your local path (ensure directory separators are escaped with double backslashes \\).
Supports multiple display modes; create five different scripts /w provided values (see below), e.g.:
- SetWallpaperMCStretched.ps1
- SetWallpaperMCFill.ps1
- SetWallpaperMCFit.ps1
- SetWallpaperMCCenter.ps1
- SetWallpaperMCTile.ps1
Notes:
Tested on MC 15.8 running on Windows 10.
To add to the context menu: navigate to Config > "Custom Context Menu" and add the script.
claude-opus-4-5-20251101-thinking-32k AI Generated::
## Step 1: Fixed PowerShell Script
Save this as `C:\SetWallpaper.ps1`:
```powershell
param([string]$ImagePath)
# Load WinForms so MessageBox works
# Add-Type -AssemblyName System.Windows.Forms
# Debug: Show what path was received (remove this line after testing)
# [System.Windows.Forms.MessageBox]::Show($ImagePath)
Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name WallpaperStyle -Value '2'
Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name TileWallpaper -Value '0'
$code = @"
using System;
using System.Runtime.InteropServices;
public class Wallpaper {
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
}
"@
Add-Type -TypeDefinition $code -ErrorAction SilentlyContinue
[Wallpaper]::SystemParametersInfo(20, 0, $ImagePath, 3)
```
---
## Step 2: Corrected MC.Run Command
The issue is likely the variable not expanding properly. Try this (Save this as a User-Defined Command then add it to Config > Custom Context Menu to set the selected file as a Stretched Wallpaper):
```multiscript
@var $imgPath = GetSourceFocusPath();
@var $arguments = "-ExecutionPolicy Bypass -File \"C:\\SetWallpaper.ps1\" -ImagePath \"" + $imgPath + "\"";
MC.Run CMD="powershell.exe" ARG="{$arguments}";
```
---
Notes (if you want other styles later)These registry values are the ones Windows uses:
- Stretch: WallpaperStyle=2, TileWallpaper=0 (used above)
- Fill: WallpaperStyle=10, TileWallpaper=0
- Fit: WallpaperStyle=6, TileWallpaper=0
- Center: WallpaperStyle=0, TileWallpaper=0
- Tile: WallpaperStyle=0, TileWallpaper=1