Closed Kenafri closed 1 year ago
Hello. Use doble quotes. You're using single quotes which does not allow PowerShell to get the variable value, instead it's passing a literal string.
Hello ! You kidding me : works like a charm !
$MediaExtensions = @(".3ga", ".3gp", ".3gp2")
foreach ($MediaExtension in $MediaExtensions){
# if ((Get-FTA .mp3) -ne 'VLC.mp3.Document'){ Set-FTA 'VLC.mp3.Document' '.mp3' | Out-Null }
Write-Host "Définition de l'association du fichier $MediaExtension (VLC$MediaExtension.Document)"
if ((Get-FTA "$MediaExtension") -ne "VLC$MediaExtension.Document"){ Set-FTA "VLC$MediaExtension.Document" "$MediaExtension" -Verbose }
Write-Host "=========================================="
Get-FTA $MediaExtension -Verbose
Write-Host ""
}
Définition de l'association du fichier .3ga (VLC.3ga.Document)
VERBOSE: ProgId: VLC.3ga.Document
VERBOSE: Extension/Protocol: .3ga
VERBOSE: Write Registry Extension: .3ga
VERBOSE: Remove Extension UserChoice Key If Exist: Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.3ga\UserChoice
VERBOSE: Write Reg Extension UserChoice OK
==========================================
VERBOSE: Get File Type Association for .3ga
VLC.3ga.Document
Définition de l'association du fichier .3gp (VLC.3gp.Document)
VERBOSE: ProgId: VLC.3gp.Document
VERBOSE: Extension/Protocol: .3gp
VERBOSE: Write Registry Extension: .3gp
VERBOSE: Remove Extension UserChoice Key If Exist: Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.3gp\UserChoice
VERBOSE: Write Reg Extension UserChoice OK
==========================================
VERBOSE: Get File Type Association for .3gp
VLC.3gp.Document
Définition de l'association du fichier .3gp2 (VLC.3gp2.Document)
VERBOSE: ProgId: VLC.3gp2.Document
VERBOSE: Extension/Protocol: .3gp2
VERBOSE: Write Registry Extension: .3gp2
VERBOSE: Remove Extension UserChoice Key If Exist: Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.3gp2\UserChoice
VERBOSE: Write Reg Extension UserChoice OK
==========================================
VERBOSE: Get File Type Association for .3gp2
VLC.3gp2.Document
Thanx!
I'm tryin' to modify multiple files associations in one go like below (NOTA : VLC is already installed):
Function Set-FTA seems to not read/convert my custom variable ($MediaExtension) correctly
================================================================
But all things go well with one extension at the time :
Your help will be appreciated. Thanx
PS : Unecessary verbose output have been removed