Last post Jan 17, 2017 06:00 AM by Eric Du
Jan 14, 2017 04:18 PM|mahendraharode|LINK
private void RunExportCommand()
appLogger.WriteLog("Starting exporting data to dump file.");
using (Process processExp = new Process())
string fileName = "exp.exe";
processExp.StartInfo.FileName = fileName;
processExp.StartInfo.Arguments = GetCommandString();
processExp.StartInfo.CreateNoWindow = true;
processExp.StartInfo.UseShellExecute = false;
processExp.StartInfo.RedirectStandardError = true;
processExp.StartInfo.RedirectStandardOutput = false;
processExp.StartInfo.RedirectStandardInput = true;
appLogger.WriteLog("Started exporting data to dump file.");
processExp.StandardInput.AutoFlush = true;
appLogger.WriteLog("Successfully exported data to dump file.");
catch (Exception e)
appLogger.WriteLog("Exception while exporting data. " + e.ToString());
throw new Exception("Exception while exporting data.", e);
In this code processExp.WaitForExit(Int32.MaxValue) line are not execute, but before that file lines are working. If I'm using created filename.txt(log) to copy or move it is showing lick error
"Error occurred in IsErrorOccurred System.IO.IOException: The process cannot access the file 'C:MyBKP\BAK_01_01062017.txt' because it is being used by another process."
Jan 14, 2017 04:43 PM|mgebhard|LINK
This is error is caused by not properly disposing file resources or not wrapping file IO in a using block.
You'll need to review the code or post the relevant bits here if you need further assistance.
Jan 16, 2017 09:17 AM|Eric Du|LINK
According to your code and exception, as far as I know, you want to access this file, but you doesn't closed it before you access it, like opening it in the software ......., so this error occurred. I suggest check if it opened in the other software or the
Here is someone meet the similar problem as you, please refer to these solutions:
IOException: The process cannot access the file 'file path' because it is being used by another process:
The process cannot access the file because it is being used by another process (File is created but contains nothing):
Jan 17, 2017 05:53 AM|mahendraharode|LINK
Problem is "exp.exe" command process not stopping automatically it is executing infinite, that's why this process use every time file.
Jan 17, 2017 06:00 AM|Eric Du|LINK
I am very glad to hear your problem has been resolved, I hope you can mark your reply as answer, because it will help more people who face the same problem as you.