Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Host.UI.RawUI.WindowTitle = "Oinkers Techpack Updater"
- $currentDirectory = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition)
- $parentDirectory = split-path (split-path $MyInvocation.MyCommand.Path -parent) -parent
- [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
- Out-Null
- $myDialog = New-Object System.Windows.Forms.OpenFileDialog
- $myDialog.Title = “Please select the Oinkers Modpack File:”
- $myDialog.InitialDirectory = “$parentDirectory”
- $myDialog.Filter = “Oinkers Modpack Files (*.oinkmod)| *.oinkmod”
- $result = $myDialog.ShowDialog()
- If($result -eq “OK”) {
- $inputFile = $myDialog.FileName
- copy-item $inputFile $currentDirectory\_temp.zip
- $shell=new-object -com shell.application
- $CurrentLocation=get-location
- $CurrentPath=$CurrentLocation.path
- $Location=$shell.namespace($CurrentPath)
- $ZipFiles = get-childitem *.zip
- $ZipFiles.count | out-default
- foreach ($ZipFile in $ZipFiles)
- {
- $ZipFile.fullname | out-default
- $ZipFolder = $shell.namespace($ZipFile.fullname)
- $Location.Copyhere($ZipFolder.items())
- }
- move-item $currentDirectory\add.bat $currentDirectory\TEMP -Force
- move-item $currentDirectory\remove.bat $currentDirectory\TEMP -Force
- move-item $currentDirectory\add $currentDirectory\TEMP -Force
- remove-item $currentDirectory\_temp.zip -Force
- Write-Host "Press any key to continue ..."
- $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
- }
- else {
- Write-Host “Cancelled by user, please try again!”
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement