0

I am creating a batch file that when a user runs it a file included in the folder is unzipped.

So like this:

Downloaded_Folder | Batch.bat | ZippedFile.zip

Though when I run the powershell command to unzip the powershell is ran from System32. I am also unsure where the user will be opening this folder from (Their downloads, or desktop, or documents?)

Here is what I have:

openfiles > NUL 2>&1 
if NOT %ERRORLEVEL% EQU 0 goto NotAdmin 
echo Hello from elevated command prompt
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('foo.zip', 'bar'); }"
goto End 
:NotAdmin 
echo This command prompt is NOT ELEVATED 
pause
:End

pause
Buddhism
  • 19
  • 1
  • 4
    I suggest you write the entire thing in Powershell. Both batch and Powershell can identify the current folder. – Nick.Mc May 25 '21 at 03:34
  • Here is a quick example that i tested on my side for downloading and Unzipping File [Download-UnZipFile.bat](https://pastebin.com/naTnnf4Z) – Hackoo May 25 '21 at 12:25

0 Answers0