SlideShare una empresa de Scribd logo
1 de 18
Windows PowerShell を使う

            丹野 嘉信
  http://ytanno.herokuapp.com/
Windows PowerShell とは
• Windows PowerShell は、マイクロソフトが
  開発した拡張可能なコマンドラインイン
  ターフェース (CLI) シェルおよびスクリプ
  ト言語
                         Wikipediaより
使うきっかけ
• Windows上でlsコマンドが使いたかった
似たようなツール
• Cygwin
普通に使うならこれ。ただ容量が重い

• Gow
容量は軽いが日本語が文字化けする
直す方法はあるらしいが見つからなかった\
(^o^)/
Windows PowerShellの利点と欠
            点
利点
• lsの出力結果で日本語が化けない
• .net を利用してスクリプトがかける
• Windows7にデフォルトでついている

欠点
• Linuxのコマンドと違う。⇒aliasでOK
使ってみよう
• ウィンドウズキーを押す
• 検索Boxに「Windows
  PowerShell」
• Windows PowerShellをクリック

• あとはお好みでショートカット
  やタスクバーに表示を選択
lsコマンド
• 青っぽい画面が出たらlsと打つ
コマンドの違い
• Get-alias
• 実際は右側のコマンドが呼ばれている




• lsはGet-ChildItemでした
Aliasの設定
• Linuxっぽく変更したい人向け
• Set-Alias 変更したいコマンド 実際の名前
• 例 Set-Alias which get-command

この設定だとPowerShellを止めたら、効果が
消えてしまう
起動時実行の設定
• まずはGet-Variable $profile
• プロファイルのパスが表示されます。
(起動時に命令を読み込んでくれます)




• ない時は自分で作るか
• コマンド New-Item -path $profile -type file -
  force
設定方法
• notepad $profile
• 起動したメモ帳に編集




• WindowsPowerShellを立ち上げなおす
• エラーが返ってくる
エラーの回避
• デフォルトではスクリプトが無効になってい
  ます

• Set-ExecutionPolicy RemoteSigned
で回避可能
パラメータの詳細は
http://www.atmarkit.co.jp/fwin2k/operation/psh02
/psh02_01.html
に書いてあります。
再度立ち上げなおす
• 成功!
Aliasの例
• Linuxのものと挙動が違うものがあります
• 参考程度にしてくだい

Set-Alias d Get-Date
Set-Alias which get-command
Set-Alias grep Select-String
Set-Alias chmod attrib

Set-Location C:UserstannoDesktop


Get-Variable profile
おまけ
• Git-Bashのように使いたい!

PowerShellでGit
http://devadjust.exblog.jp/17296786/

1 Posh-GitをGItHubからダウンロード
2 install.ps1を任意の場所に配置
3 install.ps1を実行後、reload

Profileに自動的に追加される
よく使いそうなコマンド
•   findStr
•   cp
•   tasklist
•   ps
•   Get-alias
その他参照
Windows PowerShell プロファイル
http://technet.microsoft.com/ja-
jp/scriptcenter/powershell_owner06.aspx

Windows PowerShellコマンド&スクリプティ
ング入門(後編)
http://www.atmarkit.co.jp/fwin2k/operation/ps
h02/psh02_01.html
ご清聴ありがとうございまし
      た

Más contenido relacionado

La actualidad más candente

MySQL のチューニングについて考えてみた
MySQL のチューニングについて考えてみたMySQL のチューニングについて考えてみた
MySQL のチューニングについて考えてみたTokuhiro Matsuno
 
第2回こけむさズword press部
第2回こけむさズword press部第2回こけむさズword press部
第2回こけむさズword press部Yuki Suzuki
 
PowerShell 紹介
PowerShell 紹介PowerShell 紹介
PowerShell 紹介tsudaa
 
Eggplant Functional - Lesson 8 (Japanese slides)
Eggplant Functional - Lesson 8 (Japanese slides)Eggplant Functional - Lesson 8 (Japanese slides)
Eggplant Functional - Lesson 8 (Japanese slides)Eggplant
 
WordPress 私はこんな設定をしています【WordBench Nagoya 9月勉強会】
WordPress 私はこんな設定をしています【WordBench Nagoya 9月勉強会】WordPress 私はこんな設定をしています【WordBench Nagoya 9月勉強会】
WordPress 私はこんな設定をしています【WordBench Nagoya 9月勉強会】masaya yamao
 
Powershell勉強会 v5 (こちらが最新です。)
Powershell勉強会 v5 (こちらが最新です。)Powershell勉強会 v5 (こちらが最新です。)
Powershell勉強会 v5 (こちらが最新です。)Tetsu Yama
 
Eggplant Functional - Lesson 11 (Japanese slides)
Eggplant Functional - Lesson 11 (Japanese slides)Eggplant Functional - Lesson 11 (Japanese slides)
Eggplant Functional - Lesson 11 (Japanese slides)Eggplant
 
Let s database_testing
Let s database_testingLet s database_testing
Let s database_testingYuji Shimada
 
Writeexcelについて
WriteexcelについてWriteexcelについて
Writeexcelについてasa 999
 
Play frameworkの概要
Play frameworkの概要Play frameworkの概要
Play frameworkの概要Shuhei Kaneko
 
Eggplant Functional - Lesson 9 (Japanese slides)
Eggplant Functional - Lesson 9 (Japanese slides)Eggplant Functional - Lesson 9 (Japanese slides)
Eggplant Functional - Lesson 9 (Japanese slides)Eggplant
 
#glassfishjp GlassFishとProfiler
#glassfishjp GlassFishとProfiler#glassfishjp GlassFishとProfiler
#glassfishjp GlassFishとProfilerYuji Kubota
 
20121115 fukuoka sublime0_kuroneko
20121115 fukuoka sublime0_kuroneko20121115 fukuoka sublime0_kuroneko
20121115 fukuoka sublime0_kuronekoKohki Nakashima
 
[JP] Service Cloud Trailblazers Meetup 11 Case Feed / ケースフィードのカスタマイズとWinter '...
[JP] Service Cloud Trailblazers Meetup 11 Case Feed / ケースフィードのカスタマイズとWinter '...[JP] Service Cloud Trailblazers Meetup 11 Case Feed / ケースフィードのカスタマイズとWinter '...
[JP] Service Cloud Trailblazers Meetup 11 Case Feed / ケースフィードのカスタマイズとWinter '...sfdc_sctb
 
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejsTakayoshi Tanaka
 
Web programming introduction
Web programming introductionWeb programming introduction
Web programming introductioncolun
 

La actualidad más candente (18)

MySQL のチューニングについて考えてみた
MySQL のチューニングについて考えてみたMySQL のチューニングについて考えてみた
MySQL のチューニングについて考えてみた
 
第2回こけむさズword press部
第2回こけむさズword press部第2回こけむさズword press部
第2回こけむさズword press部
 
Adobe JSX入門
Adobe JSX入門Adobe JSX入門
Adobe JSX入門
 
PowerShell 紹介
PowerShell 紹介PowerShell 紹介
PowerShell 紹介
 
Eggplant Functional - Lesson 8 (Japanese slides)
Eggplant Functional - Lesson 8 (Japanese slides)Eggplant Functional - Lesson 8 (Japanese slides)
Eggplant Functional - Lesson 8 (Japanese slides)
 
WordPress 私はこんな設定をしています【WordBench Nagoya 9月勉強会】
WordPress 私はこんな設定をしています【WordBench Nagoya 9月勉強会】WordPress 私はこんな設定をしています【WordBench Nagoya 9月勉強会】
WordPress 私はこんな設定をしています【WordBench Nagoya 9月勉強会】
 
Powershell勉強会 v5 (こちらが最新です。)
Powershell勉強会 v5 (こちらが最新です。)Powershell勉強会 v5 (こちらが最新です。)
Powershell勉強会 v5 (こちらが最新です。)
 
Eggplant Functional - Lesson 11 (Japanese slides)
Eggplant Functional - Lesson 11 (Japanese slides)Eggplant Functional - Lesson 11 (Japanese slides)
Eggplant Functional - Lesson 11 (Japanese slides)
 
Let s database_testing
Let s database_testingLet s database_testing
Let s database_testing
 
Writeexcelについて
WriteexcelについてWriteexcelについて
Writeexcelについて
 
Nodejs
NodejsNodejs
Nodejs
 
Play frameworkの概要
Play frameworkの概要Play frameworkの概要
Play frameworkの概要
 
Eggplant Functional - Lesson 9 (Japanese slides)
Eggplant Functional - Lesson 9 (Japanese slides)Eggplant Functional - Lesson 9 (Japanese slides)
Eggplant Functional - Lesson 9 (Japanese slides)
 
#glassfishjp GlassFishとProfiler
#glassfishjp GlassFishとProfiler#glassfishjp GlassFishとProfiler
#glassfishjp GlassFishとProfiler
 
20121115 fukuoka sublime0_kuroneko
20121115 fukuoka sublime0_kuroneko20121115 fukuoka sublime0_kuroneko
20121115 fukuoka sublime0_kuroneko
 
[JP] Service Cloud Trailblazers Meetup 11 Case Feed / ケースフィードのカスタマイズとWinter '...
[JP] Service Cloud Trailblazers Meetup 11 Case Feed / ケースフィードのカスタマイズとWinter '...[JP] Service Cloud Trailblazers Meetup 11 Case Feed / ケースフィードのカスタマイズとWinter '...
[JP] Service Cloud Trailblazers Meetup 11 Case Feed / ケースフィードのカスタマイズとWinter '...
 
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs
 
Web programming introduction
Web programming introductionWeb programming introduction
Web programming introduction
 

Destacado

2012 kanemotolablecture6
2012 kanemotolablecture62012 kanemotolablecture6
2012 kanemotolablecture6ytanno
 
2012 kanemotolablecture2
2012 kanemotolablecture22012 kanemotolablecture2
2012 kanemotolablecture2ytanno
 
Sfm memo
Sfm memoSfm memo
Sfm memoytanno
 
Type scriptmemo
Type scriptmemoType scriptmemo
Type scriptmemoytanno
 
Be project
Be projectBe project
Be projectsneha94
 
2012 kanemotolablecture1
2012 kanemotolablecture12012 kanemotolablecture1
2012 kanemotolablecture1ytanno
 

Destacado (7)

Reflexion modulo 1
Reflexion modulo 1Reflexion modulo 1
Reflexion modulo 1
 
2012 kanemotolablecture6
2012 kanemotolablecture62012 kanemotolablecture6
2012 kanemotolablecture6
 
2012 kanemotolablecture2
2012 kanemotolablecture22012 kanemotolablecture2
2012 kanemotolablecture2
 
Sfm memo
Sfm memoSfm memo
Sfm memo
 
Type scriptmemo
Type scriptmemoType scriptmemo
Type scriptmemo
 
Be project
Be projectBe project
Be project
 
2012 kanemotolablecture1
2012 kanemotolablecture12012 kanemotolablecture1
2012 kanemotolablecture1
 

Similar a Power shellmemo

IT Pro のための PowerShell スクリプティング
IT Pro のための PowerShell スクリプティングIT Pro のための PowerShell スクリプティング
IT Pro のための PowerShell スクリプティングKazuki Takai
 
Windows PowerShell 2.0 の基礎知識
Windows PowerShell 2.0 の基礎知識Windows PowerShell 2.0 の基礎知識
Windows PowerShell 2.0 の基礎知識shigeya
 
Powershell基礎_20180521用
Powershell基礎_20180521用Powershell基礎_20180521用
Powershell基礎_20180521用Tetsu Yama
 
DLR言語によるSilverlightプログラミング
DLR言語によるSilverlightプログラミングDLR言語によるSilverlightプログラミング
DLR言語によるSilverlightプログラミングterurou
 
WTM53 phpフレームワーク いまさらcodeigniter
WTM53 phpフレームワーク いまさらcodeigniterWTM53 phpフレームワーク いまさらcodeigniter
WTM53 phpフレームワーク いまさらcodeigniterMasanori Oobayashi
 
仮想マシンを使った開発環境の簡単共有方法
仮想マシンを使った開発環境の簡単共有方法 仮想マシンを使った開発環境の簡単共有方法
仮想マシンを使った開発環境の簡単共有方法 Hideo Takahashi
 
Jjug ccc 2016 spring i 5 javaデスクトッププログラムを云々
Jjug ccc 2016 spring i 5 javaデスクトッププログラムを云々Jjug ccc 2016 spring i 5 javaデスクトッププログラムを云々
Jjug ccc 2016 spring i 5 javaデスクトッププログラムを云々torutk
 
CodeIgniter入門
CodeIgniter入門CodeIgniter入門
CodeIgniter入門Sho A
 
使い捨て python コードの書き方
使い捨て python コードの書き方使い捨て python コードの書き方
使い捨て python コードの書き方Sho Shimauchi
 
Azure CLI あずにゃんの CLI を使ってみた結果www
Azure CLI あずにゃんの CLI を使ってみた結果wwwAzure CLI あずにゃんの CLI を使ってみた結果www
Azure CLI あずにゃんの CLI を使ってみた結果wwwMasahito Zembutsu
 
はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入Yu Nobuoka
 
Javaで1から10まで書いた話(sanitized)
Javaで1から10まで書いた話(sanitized)Javaで1から10まで書いた話(sanitized)
Javaで1から10まで書いた話(sanitized)Tokuhiro Matsuno
 
Debug Hacks at Security and Programming camp 2011
Debug Hacks at Security and Programming camp 2011 Debug Hacks at Security and Programming camp 2011
Debug Hacks at Security and Programming camp 2011 Hiro Yoshioka
 
PHPフレームワーク入門
PHPフレームワーク入門PHPフレームワーク入門
PHPフレームワーク入門Sho A
 
Guide to GraalVM (Oracle Groundbreakers APAC 2019 Tour in Tokyo)
Guide to GraalVM (Oracle Groundbreakers APAC 2019 Tour in Tokyo)Guide to GraalVM (Oracle Groundbreakers APAC 2019 Tour in Tokyo)
Guide to GraalVM (Oracle Groundbreakers APAC 2019 Tour in Tokyo)Koichi Sakata
 

Similar a Power shellmemo (20)

IT Pro のための PowerShell スクリプティング
IT Pro のための PowerShell スクリプティングIT Pro のための PowerShell スクリプティング
IT Pro のための PowerShell スクリプティング
 
Windows PowerShell 2.0 の基礎知識
Windows PowerShell 2.0 の基礎知識Windows PowerShell 2.0 の基礎知識
Windows PowerShell 2.0 の基礎知識
 
Powershell基礎_20180521用
Powershell基礎_20180521用Powershell基礎_20180521用
Powershell基礎_20180521用
 
DLR言語によるSilverlightプログラミング
DLR言語によるSilverlightプログラミングDLR言語によるSilverlightプログラミング
DLR言語によるSilverlightプログラミング
 
WTM53 phpフレームワーク いまさらcodeigniter
WTM53 phpフレームワーク いまさらcodeigniterWTM53 phpフレームワーク いまさらcodeigniter
WTM53 phpフレームワーク いまさらcodeigniter
 
仮想マシンを使った開発環境の簡単共有方法
仮想マシンを使った開発環境の簡単共有方法 仮想マシンを使った開発環境の簡単共有方法
仮想マシンを使った開発環境の簡単共有方法
 
Jjug ccc 2016 spring i 5 javaデスクトッププログラムを云々
Jjug ccc 2016 spring i 5 javaデスクトッププログラムを云々Jjug ccc 2016 spring i 5 javaデスクトッププログラムを云々
Jjug ccc 2016 spring i 5 javaデスクトッププログラムを云々
 
CodeIgniter入門
CodeIgniter入門CodeIgniter入門
CodeIgniter入門
 
使い捨て python コードの書き方
使い捨て python コードの書き方使い捨て python コードの書き方
使い捨て python コードの書き方
 
Azure CLI あずにゃんの CLI を使ってみた結果www
Azure CLI あずにゃんの CLI を使ってみた結果wwwAzure CLI あずにゃんの CLI を使ってみた結果www
Azure CLI あずにゃんの CLI を使ってみた結果www
 
はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入
 
Ppl
PplPpl
Ppl
 
Javaで1から10まで書いた話(sanitized)
Javaで1から10まで書いた話(sanitized)Javaで1から10まで書いた話(sanitized)
Javaで1から10まで書いた話(sanitized)
 
Redmine Ansible
Redmine AnsibleRedmine Ansible
Redmine Ansible
 
Write-Help
Write-HelpWrite-Help
Write-Help
 
Debug Hacks at Security and Programming camp 2011
Debug Hacks at Security and Programming camp 2011 Debug Hacks at Security and Programming camp 2011
Debug Hacks at Security and Programming camp 2011
 
Chef
ChefChef
Chef
 
入門 シェル実装
入門 シェル実装入門 シェル実装
入門 シェル実装
 
PHPフレームワーク入門
PHPフレームワーク入門PHPフレームワーク入門
PHPフレームワーク入門
 
Guide to GraalVM (Oracle Groundbreakers APAC 2019 Tour in Tokyo)
Guide to GraalVM (Oracle Groundbreakers APAC 2019 Tour in Tokyo)Guide to GraalVM (Oracle Groundbreakers APAC 2019 Tour in Tokyo)
Guide to GraalVM (Oracle Groundbreakers APAC 2019 Tour in Tokyo)
 

Más de ytanno

How to be friend with Attiny202 which is small microcontroller
How to be friend with Attiny202 which is small microcontrollerHow to be friend with Attiny202 which is small microcontroller
How to be friend with Attiny202 which is small microcontrollerytanno
 
Process of Interval Photograph System
Process of Interval Photograph SystemProcess of Interval Photograph System
Process of Interval Photograph Systemytanno
 
How to make an effort for good job
How to make an effort for good jobHow to make an effort for good job
How to make an effort for good jobytanno
 
How To Bind Cuda And OpenCV
How To Bind Cuda And OpenCV How To Bind Cuda And OpenCV
How To Bind Cuda And OpenCV ytanno
 
How to autorun graphic application
How to autorun graphic applicationHow to autorun graphic application
How to autorun graphic applicationytanno
 
How to setup 3D printer (Ender 3 pro)
How to setup 3D printer (Ender 3 pro)How to setup 3D printer (Ender 3 pro)
How to setup 3D printer (Ender 3 pro)ytanno
 
How to set https server
How to set https serverHow to set https server
How to set https serverytanno
 
How to write code in Attiny10
How to write code in Attiny10How to write code in Attiny10
How to write code in Attiny10ytanno
 
How to set up two i2cs on Attiny841
How to set up two i2cs on Attiny841How to set up two i2cs on Attiny841
How to set up two i2cs on Attiny841ytanno
 
How to write code on MachXO2
How to write code on MachXO2How to write code on MachXO2
How to write code on MachXO2ytanno
 
K-means and X-means
K-means and X-meansK-means and X-means
K-means and X-meansytanno
 
First Step SVM
First Step SVMFirst Step SVM
First Step SVMytanno
 
さるでも分かりたい9dofで作るクォータニオン姿勢
さるでも分かりたい9dofで作るクォータニオン姿勢さるでも分かりたい9dofで作るクォータニオン姿勢
さるでも分かりたい9dofで作るクォータニオン姿勢ytanno
 
Xaml html5
Xaml html5Xaml html5
Xaml html5ytanno
 
C# でブラウザ操作
C# でブラウザ操作C# でブラウザ操作
C# でブラウザ操作ytanno
 
PI制御を作ってみた
PI制御を作ってみたPI制御を作ってみた
PI制御を作ってみたytanno
 
CharpTwitter
CharpTwitterCharpTwitter
CharpTwitterytanno
 
MongoDBCSharp
MongoDBCSharpMongoDBCSharp
MongoDBCSharpytanno
 
VisualStudinoの役に立ちそうな拡張機能をまとめてみた
VisualStudinoの役に立ちそうな拡張機能をまとめてみたVisualStudinoの役に立ちそうな拡張機能をまとめてみた
VisualStudinoの役に立ちそうな拡張機能をまとめてみたytanno
 
2013_kougi6
2013_kougi62013_kougi6
2013_kougi6ytanno
 

Más de ytanno (20)

How to be friend with Attiny202 which is small microcontroller
How to be friend with Attiny202 which is small microcontrollerHow to be friend with Attiny202 which is small microcontroller
How to be friend with Attiny202 which is small microcontroller
 
Process of Interval Photograph System
Process of Interval Photograph SystemProcess of Interval Photograph System
Process of Interval Photograph System
 
How to make an effort for good job
How to make an effort for good jobHow to make an effort for good job
How to make an effort for good job
 
How To Bind Cuda And OpenCV
How To Bind Cuda And OpenCV How To Bind Cuda And OpenCV
How To Bind Cuda And OpenCV
 
How to autorun graphic application
How to autorun graphic applicationHow to autorun graphic application
How to autorun graphic application
 
How to setup 3D printer (Ender 3 pro)
How to setup 3D printer (Ender 3 pro)How to setup 3D printer (Ender 3 pro)
How to setup 3D printer (Ender 3 pro)
 
How to set https server
How to set https serverHow to set https server
How to set https server
 
How to write code in Attiny10
How to write code in Attiny10How to write code in Attiny10
How to write code in Attiny10
 
How to set up two i2cs on Attiny841
How to set up two i2cs on Attiny841How to set up two i2cs on Attiny841
How to set up two i2cs on Attiny841
 
How to write code on MachXO2
How to write code on MachXO2How to write code on MachXO2
How to write code on MachXO2
 
K-means and X-means
K-means and X-meansK-means and X-means
K-means and X-means
 
First Step SVM
First Step SVMFirst Step SVM
First Step SVM
 
さるでも分かりたい9dofで作るクォータニオン姿勢
さるでも分かりたい9dofで作るクォータニオン姿勢さるでも分かりたい9dofで作るクォータニオン姿勢
さるでも分かりたい9dofで作るクォータニオン姿勢
 
Xaml html5
Xaml html5Xaml html5
Xaml html5
 
C# でブラウザ操作
C# でブラウザ操作C# でブラウザ操作
C# でブラウザ操作
 
PI制御を作ってみた
PI制御を作ってみたPI制御を作ってみた
PI制御を作ってみた
 
CharpTwitter
CharpTwitterCharpTwitter
CharpTwitter
 
MongoDBCSharp
MongoDBCSharpMongoDBCSharp
MongoDBCSharp
 
VisualStudinoの役に立ちそうな拡張機能をまとめてみた
VisualStudinoの役に立ちそうな拡張機能をまとめてみたVisualStudinoの役に立ちそうな拡張機能をまとめてみた
VisualStudinoの役に立ちそうな拡張機能をまとめてみた
 
2013_kougi6
2013_kougi62013_kougi6
2013_kougi6
 

Power shellmemo