Created
January 13, 2012 08:07
-
-
Save t-mat/1605055 to your computer and use it in GitHub Desktop.
PowerShellのみを用いて、curl, 7zaをダウンロード、展開し、使える状態にする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 作業用ディレクトリ $t を定義 (C:\Users\<ユーザ名>\mytemp) | |
$t="$env:USERPROFILE\mytemp" | |
mkdir $t | |
pushd $t | |
# 新しいツール類のバイナリを入れるディレクトリ $n を定義 (C:\Users\<ユーザ名>\bin) | |
$n="$env:USERPROFILE\bin" | |
# $n を作り、一時的に PATH へ追加 | |
mkdir -force $n | |
$env:path += ";$n" | |
# cURLをダウンロード、展開して curl.exe を $n へ追加 | |
$curl_url="http://curl.haxx.se/download/curl-7.19.5-win32-nossl.zip" | |
$s=new-object -com shell.application | |
(new-object System.Net.WebClient).DownloadFile($curl_url, (pwd).Path+"\curl.zip") | |
$s.namespace((pwd).Path).Copyhere($s.namespace((pwd).Path+"\curl.zip").items(),0x14) | |
copy curl-7.19.5\curl.exe $n | |
# 7-Zip (7za) をダウンロード、展開して 7za.exe を $n へ追加 | |
$zip_url="http://sourceforge.net/projects/sevenzip/files/7-Zip/9.20/7za920.zip/download" | |
curl -L $zip_url -o 7za.zip | |
$s.namespace((pwd).Path).Copyhere($s.namespace((pwd).Path+"\7za.zip").items(),0x14) | |
copy 7za.exe $n | |
# 後始末 | |
popd | |
rmdir -recurse $t | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment