0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

C#で別アプリ実行

Last updated at Posted at 2019-09-12

Process.Start()で外部アプリを呼び出す

ExecuteAnotherApp(...)外部アプリを呼び出す
in string PathNameは呼び出したいアプリのパス
in string Argumentsはコマンドラインの呼び出し時の引数
bool UseShellExecuteはシェル機能を使うか
bool CreateNoWindowはコンソールウィンドウを開くか?デバッグのときは開いてもいい気がする
HageHage()呼び出し例

ExecuteAnotherApp.cs
        private void ExecuteAnotherApp(in string FileName, in string Arguments, bool UseShellExecute, bool CreateNoWindow) {
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo {
                FileName = FileName, Arguments = Arguments,
                UseShellExecute = UseShellExecute,//false:シェル機能を使用しない
                CreateNoWindow = CreateNoWindow    //true:コンソールウィンドウを開かない
            }).WaitForExit();//終了を待つ
        }

        private void HageHage() {
            ExecuteAnotherApp("FusaFusa.exe","hage husa husahusa", false, true);//"hage husa husa"引数は三つ.なしのときは""でいい
        }

参照
https://www.atmarkit.co.jp/fdotnet/dotnettips/805pipeasync/pipeasync.html

0
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?