Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell zip extraction and downloading inside folder throws exception #3

Open
fawazahmed0 opened this issue Apr 20, 2020 · 0 comments

Comments

@fawazahmed0
Copy link
Owner

fawazahmed0 commented Apr 20, 2020

Reported by:
This bug was reported by ToomBeamZ@xda at here

Screenshots:
IMG20200420132927

IMG20200420132940

The following zip extraction code fails as shown in the above screenshots:

:: Source: https://stackoverflow.com/questions/37814037/how-to-unzip-a-zip-file-with-powershell-version-2-0
:: Source: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6
:: Extracting the .zip file to installation location
echo Installing the files
PowerShell -Command "& {$shell_app=new-object -com shell.application; $filename = \"adbinstallerpackage.zip\"; $zip_file = $shell_app.namespace((Get-Location).Path + \"\$filename\"); $destination = $shell_app.namespace($Env:ProgramFiles); $destination.Copyhere($zip_file.items());}"
echo Installing USB drivers
PowerShell -Command "& {$shell_app=new-object -com shell.application; $filename = \"google_usb_driver.zip\"; $zip_file = $shell_app.namespace((Get-Location).Path + \"\$filename\"); $destination = $shell_app.namespace((Get-Location).Path); $destination.Copyhere($zip_file.items());}"

IMG20200420132948

Downloading a file in a folder named usb_driver also fails

:: Fetching unsigned driver installer tool
echo Downloading unsigned driver installer tool
PowerShell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/fawazahmed0/windows-unsigned-driver-installer/master/unsigned_driver_installer.bat', 'usb_driver\unsigned_driver_installer.bat')"

IMG20200420132955

Quick Fix:

A quick fix to this was given here

A stripped down offline version was made, where code for downloading files from internet and zip extraction was removed and all the files are already downloaded and extracted in the fix:

  1. Download the attached 'ADB Fastboot & USB Driver Installer Offline.zip' and extract it.

  2. Connect your phone with USB debugging enabled to pc (or if you just want fastboot drivers to be installed ,boot your phone in fastboot mode and connect it to pc)

  3. Go inside extracted folder and double click Latest-ADB-Installer.bat to start the installation.

ADB Fastboot & USB Driver Installer Offline.zip

Debugging:
This issue might be something related to the user's buggy windows installation/configuration as suggested here

So I will not be debugging this issue until some more people come up with the same problem and provide more information

I can create an github CI/CD code stripped offline version of this tool to solve many unique issues faced by the users, which cannot be easily debugged by me, (do this only if users report many unique issues which cannot be debugged easily)
Just incase I go ahead with CI/CD code stripped offline version, make offline tool branch with ci every day (only do if many bugs reported due to my code), use self extracting and auto installer run archive as shown here

config.txt file content:

;!@Install@!UTF-8!
RunProgram="Latest-ADB-Installer.bat"
;!@InstallEnd@!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant