Powershellを使ってみる
開発環境は、Windows 10 Pro(64bit)。
■Powershellを呼び出す
- Windowsキーを押しながら、Rを押す
- ファイル名を指定して実行ウィンドウ内にて、powershellと入力する
■コマンドプロンプトからPowershellを呼び出す
単純にコマンドプロンプト上で、Powershellに切り替える。PSと表示されたら、切り替わった証拠。
powershell
逆にコマンドプロンプトに戻したければ、
cmd
と入力するだけ。
以下の例では、Powershellを呼び出して、dirコマンドを実行する。ダブルクォーテーションで囲っても囲わなくても構わない。
powershell -Command "dir" powershell -Command dir
以下の例では、Powershellを呼び出して、mkdirコマンドで、test_powershellディレクトリを作成している。
powershell -Command mkdir test_powershell powershell -Command "mkdir test_powershell"
cdは、なぜか機能しなかった。1回、powershellに切り替えてから、cdを使わないと機能しない。
powershell -Command cd c:\test_powershell powershell -Command "cd c:\test_powershell"