-
関連項目
- 関数
- ExternalEvaluate
- RunThrough
- Run
- StartProcess
- Install
- Put
- Get
- Import
- $SystemShell
-
- 外部評価システム
- Shell
- 関連するガイド
RunProcess["command"]
指定された外部コマンドを実行し,結果についての情報を返す.
RunProcess[{"command",arg1,arg2,…}]
コマンドライン引数 argiで,指定されたコマンドを実行する.
RunProcess[command,"prop"]
指定された特性のみを返す.
RunProcess[command,prop,input]
指定された最初の入力をコマンドにフィードする.


RunProcess
RunProcess["command"]
指定された外部コマンドを実行し,結果についての情報を返す.
RunProcess[{"command",arg1,arg2,…}]
コマンドライン引数 argiで,指定されたコマンドを実行する.
RunProcess[command,"prop"]
指定された特性のみを返す.
RunProcess[command,prop,input]
指定された最初の入力をコマンドにフィードする.
詳細

- RunProcessは,それが始めたプロセスが終了するまでブロックする.
- RunProcess[command,prop,input]では,input はToStringを使って自動的に文字列に変換される.RunProcess[{command,arg1,…},…]の argiについても同様である.
- よく返される特性には以下がある.
-
"ExitCode" プロセスの終了コード "StandardOutput" 文字列として標準的な出力に送られるデータ "StandardError" 文字列として標準的なエラーに送られるデータ All すべての特性の連想(デフォルト) - RunProcessのオプション
-
ProcessDirectory Inherited 初期作業ディレクトリ ProcessEnvironment Inherited 供給する環境変数 - デフォルトで,サブプロセスはそのプロセスディレクトリと環境変数をWolfram Engineから継承する.
例題
すべて開く すべて閉じる例 (4)
考えられる問題 (4)
リストを使うことが,プログラムとその変数のためにRunProcessを呼び出す正しい方法である:
1つの文字列にコマンドと引数を入れてRunProcessを呼んでもうまく行かない:

同様に,プログラムの引数をRunProcessの引数としてRunProcessを呼ぶことは許されていない:

~ や * のような特殊記号は,RunProcessがシェルをスキップするので,シェル式を使っても変換されない:
dirやechoのようなシェルコマンドはバイナリではないので,Windowsでは直接呼び出すことができない(Unixシステム上ではこれらはバイナリである):
関連項目
ExternalEvaluate RunThrough Run StartProcess Install Put Get Import $SystemShell
外部評価システム: Shell
Function Repository: SystemShellRun ProcessRunningQ GetNetworkSpeed
関連するガイド
-
▪
- 外部プログラムの呼出し ▪
- 外部言語インターフェース ▪
- 外部プロセスの直接制御 ▪
- 外部操作
テキスト
Wolfram Research (2014), RunProcess, Wolfram言語関数, https://reference.wolfram.com/language/ref/RunProcess.html.
CMS
Wolfram Language. 2014. "RunProcess." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RunProcess.html.
APA
Wolfram Language. (2014). RunProcess. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RunProcess.html
BibTeX
@misc{reference.wolfram_2025_runprocess, author="Wolfram Research", title="{RunProcess}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/RunProcess.html}", note=[Accessed: 14-September-2025]}
BibLaTeX
@online{reference.wolfram_2025_runprocess, organization={Wolfram Research}, title={RunProcess}, year={2014}, url={https://reference.wolfram.com/language/ref/RunProcess.html}, note=[Accessed: 14-September-2025]}