In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Recently, writing a script encountered a problem of unzipping files. I have tried a lot of methods. Now let's sum it up.
1. Use third-party decompression software, such as 7zip#Extract ZIP filesif (- not (test-path "$env:ProgramFiles\ 7-Zip\ 7z.exe") {throw "$env:ProgramFiles\ 7-Zip\ 7z.exe needed"} set-alias sz "$env:ProgramFiles\ 7-Zip\ 7z.exe" sz x "$destinationpath"-y-oC:\ Wicn_sys #-oC:\ Wicn_sys there will be problems with variables. I use a fixed path.
First of all, it is necessary for the clients to have 7zip software installed, and it is not successful to run on some clients. After all, there are some problems with the efficiency and success rate of invoking third-party tools.
2. Windows built-in decompression function
You find a compressed file on the client, right-click, if there is an Extract All function, it means that there is a built-in windows self-decompression function. Easy to use, but requires. Net version conditions,. Net 4.5 or above
$BackUpPath = "C:\ a.zip" $Destination = "C:\ 1" Add-Type-assembly "system.io.compression.filesystem" [io.compression.zipfile]:: ExtractToDirectory ($BackUpPath, $destination)
If an error is reported, the currently running .net version is low.
3. To call the COM object, as with method 2, you must have PS version 2.0 or above $shell = New-Object-ComObject shell.application$zip = $shell.NameSpace ("C:\ a.zip") MkDir ("C:\ a") foreach ($item in $zip.items ()) {$shell.Namespace ("C:\ a") .CopyHere ($item)}
After messing around all day, in order to avoid everyone wasting time, there are only two points in the end.
If you do a batch push, either you install 7zip software on your client, or upgrade all clients to .net or above.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.