C#(.net2.0)にてWindowsアプリケーションにてexeファイル生成して
サービス等でexepathに入るバッチを実行する。
バッチ側ではaaa.logを権限変更する処理を実行する。
exe実行するも、外部バッチが実行されません。
■C#
this.process_ = new Process();
int exitCode;
string exepath = @"C:\sample.bat";
this.process_.StartInfo.FileName = exepath;
this.process_.StartInfo.UseShellExecute = false;
this.process_.StartInfo.RedirectStandardOutput = true;
this.process_.StartInfo.RedirectStandardError = true;
this.process_.StartInfo.RedirectStandardInput = false;
this.process_.StartInfo.CreateNoWindow = true;
this.process_.Start();
this.process_.BeginOutputReadLine();
this.process_.BeginErrorReadLine();
if (!this.process_.WaitForExit(100000))
{
this.process_.Close();
return EXEC_FAILED_CODE;
}
exitCode = this.process_.ExitCode;
this.process_.Close();
return EXEC_FAILED_CODE;
■sample.bat
echo y > tmp.file
CACLS aaa.log /e /g everyone:f < tmp.file
exit /b
★追加
this.process_.StartInfo.RedirectStandardInput = true; に変更したら動作しますがなぜか判るかた教えて下さい。
また、trueに変更することで他のバッチ指定時の動作に影響する箇所が無いか気にしています。