unzip files to desktop
This commit is contained in:
parent
12f647835e
commit
647bcdfe53
@ -1,4 +1,5 @@
|
||||
"C:\Users\WDAGUtilityAccount\Desktop\Sandbox Scripts\7zip.exe" /S
|
||||
powershell -command 'Set-ExecutionPolicy Unrestricted'
|
||||
powershell -command 'Unblock-File -Path "C:\Users\WDAGUtilityAccount\Desktop\Sandbox Scripts\prepare.ps1"'
|
||||
"C:\Users\WDAGUtilityAccount\Desktop\Sandbox Scripts\python3.exe" /S
|
||||
"C:\Users\WDAGUtilityAccount\Desktop\Sandbox Scripts\vlc.exe" /S
|
||||
curl -L "https://update.code.visualstudio.com/latest/win32-x64-user/stable" --output C:\users\WDAGUtilityAccount\Downloads\vscode.exe
|
||||
|
||||
@ -4,13 +4,27 @@
|
||||
|
||||
#Copy items to desktop
|
||||
Copy-Item './extract.py' '..';
|
||||
Get-ChildItem | Where-Object { $_.name -match '\.zip'} | ForEach-Object {Copy-Item -Path $_.name -Destination '..' }
|
||||
#Get-ChildItem | Where-Object { $_.name -match '\.zip'} | ForEach-Object {Copy-Item -Path $_.name -Destination '..' }
|
||||
|
||||
#Capture zip password from filename
|
||||
$pwPattern = [regex] "[A-z 0-9 \-]{1,251}\((?<PW>[A-z0-9]{1,251})\)\.zip";
|
||||
$files = @{};
|
||||
Get-ChildItem './Sandbox Scripts'| Where-Object { $_.name -match '\.zip'} | ForEach-Object {
|
||||
$pass = [Regex]::Matches($_, $pwPattern);
|
||||
$files.Add($_.name, $pass.groups[1].Value);
|
||||
}
|
||||
|
||||
$files = Get-ChildItem;
|
||||
$passwords = [Regex]::Matches($files, $pwPattern);
|
||||
$passwords.groups | Where-Object {$_.Name -match "PW"} | ForEach-Object {Write-Output $_.Value }
|
||||
|
||||
#Install 7Zip and extract the zip files to the desktop.
|
||||
Write-Output "Installing Programs...";
|
||||
Start-Process "C:\Users\WDAGUtilityAccount\Desktop\Sandbox Scripts\7zip.exe" -NoNewWindow -Wait -ArgumentList /S;
|
||||
$sevenZip = "C:\Program Files\7-Zip\7z.exe";
|
||||
foreach ($file in $files.GetEnumerator()){
|
||||
Write-Output "Extracting $($file.Name)";
|
||||
$archivePath = "C:\Users\WDAGUtilityAccount\Desktop\Sandbox Scripts\$($file.Name)"
|
||||
$outputPath = "C:\Users\WDAGUtilityAccount\Desktop\$($file.Name)";
|
||||
$password = $($file.Value);
|
||||
$arguments = "$($archivePath)", "-o$($outputPath)", "-p$($password)";
|
||||
&$sevenZip e $arguments;
|
||||
}
|
||||
Write-Output Done;
|
||||
Loading…
x
Reference in New Issue
Block a user