Unable to set Process.StartInfo.WorkingDirectory to call exe from c#
I'm trying to call chrome.exe inside a C# program by using System.Diagnostics.Process namespace.
my chrome.exe is located inside path C:Program Files (x86)GoogleChromeApplication
if I call RunProc function by passing bellow parameters - (keep absolute path of the exe and keep WorkingDirectory empty)
("C:Program Files (x86)GoogleChromeApplicationChrome.exe" , "https://www.google.com", "") it works just fine.
But, with parameters -
("Chrome.exe , "https://www.google.com", "C:Program Files (x86)GoogleChromeApplication") it gives exception at step proc.Start(); stating - The system cannot find the file specified.
I also tried writing WorkingDirectory = workingDir while initializing StartInfo but still looking for solutions.
class Program
{
static void Main(string args)
{
RunProc(@"chrome.exe", @"https://www.google.com", @"C:Program Files (x86)GoogleChromeApplication");
}
static bool RunProc(string exe, string args, string workingDir)
{
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
//WorkingDirectory = workingDir
}
};
if (!string.IsNullOrEmpty(workingDir))
{
proc.StartInfo.WorkingDirectory = workingDir;
}
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
}
c# process system.diagnostics
add a comment |
I'm trying to call chrome.exe inside a C# program by using System.Diagnostics.Process namespace.
my chrome.exe is located inside path C:Program Files (x86)GoogleChromeApplication
if I call RunProc function by passing bellow parameters - (keep absolute path of the exe and keep WorkingDirectory empty)
("C:Program Files (x86)GoogleChromeApplicationChrome.exe" , "https://www.google.com", "") it works just fine.
But, with parameters -
("Chrome.exe , "https://www.google.com", "C:Program Files (x86)GoogleChromeApplication") it gives exception at step proc.Start(); stating - The system cannot find the file specified.
I also tried writing WorkingDirectory = workingDir while initializing StartInfo but still looking for solutions.
class Program
{
static void Main(string args)
{
RunProc(@"chrome.exe", @"https://www.google.com", @"C:Program Files (x86)GoogleChromeApplication");
}
static bool RunProc(string exe, string args, string workingDir)
{
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
//WorkingDirectory = workingDir
}
};
if (!string.IsNullOrEmpty(workingDir))
{
proc.StartInfo.WorkingDirectory = workingDir;
}
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
}
c# process system.diagnostics
It would be awesome if you could provide a Minimal, Complete, and Verifiable example, so we can see in code how you are calling that method (and with what parameters).
– mjwills
Nov 15 '18 at 11:08
With this line:FileName = exe
, doesexe
contain the full path to the file you want to start, or simply the file name? The Working Directory isn't used to execute the file
– Martin
Nov 15 '18 at 11:08
The Variable exe contains only file name. I want to set the working directory where the file is present. And if the file is available in your working directly so you should be able to run exe only with name.
– Arkil Shaikh
Nov 15 '18 at 13:41
@mjwills - I have updated the question, given full working code and an example.Hope this will help.
– Arkil Shaikh
Nov 16 '18 at 4:42
add a comment |
I'm trying to call chrome.exe inside a C# program by using System.Diagnostics.Process namespace.
my chrome.exe is located inside path C:Program Files (x86)GoogleChromeApplication
if I call RunProc function by passing bellow parameters - (keep absolute path of the exe and keep WorkingDirectory empty)
("C:Program Files (x86)GoogleChromeApplicationChrome.exe" , "https://www.google.com", "") it works just fine.
But, with parameters -
("Chrome.exe , "https://www.google.com", "C:Program Files (x86)GoogleChromeApplication") it gives exception at step proc.Start(); stating - The system cannot find the file specified.
I also tried writing WorkingDirectory = workingDir while initializing StartInfo but still looking for solutions.
class Program
{
static void Main(string args)
{
RunProc(@"chrome.exe", @"https://www.google.com", @"C:Program Files (x86)GoogleChromeApplication");
}
static bool RunProc(string exe, string args, string workingDir)
{
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
//WorkingDirectory = workingDir
}
};
if (!string.IsNullOrEmpty(workingDir))
{
proc.StartInfo.WorkingDirectory = workingDir;
}
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
}
c# process system.diagnostics
I'm trying to call chrome.exe inside a C# program by using System.Diagnostics.Process namespace.
my chrome.exe is located inside path C:Program Files (x86)GoogleChromeApplication
if I call RunProc function by passing bellow parameters - (keep absolute path of the exe and keep WorkingDirectory empty)
("C:Program Files (x86)GoogleChromeApplicationChrome.exe" , "https://www.google.com", "") it works just fine.
But, with parameters -
("Chrome.exe , "https://www.google.com", "C:Program Files (x86)GoogleChromeApplication") it gives exception at step proc.Start(); stating - The system cannot find the file specified.
I also tried writing WorkingDirectory = workingDir while initializing StartInfo but still looking for solutions.
class Program
{
static void Main(string args)
{
RunProc(@"chrome.exe", @"https://www.google.com", @"C:Program Files (x86)GoogleChromeApplication");
}
static bool RunProc(string exe, string args, string workingDir)
{
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
//WorkingDirectory = workingDir
}
};
if (!string.IsNullOrEmpty(workingDir))
{
proc.StartInfo.WorkingDirectory = workingDir;
}
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
}
c# process system.diagnostics
c# process system.diagnostics
edited Nov 16 '18 at 4:42
Arkil Shaikh
asked Nov 15 '18 at 10:57
Arkil ShaikhArkil Shaikh
785
785
It would be awesome if you could provide a Minimal, Complete, and Verifiable example, so we can see in code how you are calling that method (and with what parameters).
– mjwills
Nov 15 '18 at 11:08
With this line:FileName = exe
, doesexe
contain the full path to the file you want to start, or simply the file name? The Working Directory isn't used to execute the file
– Martin
Nov 15 '18 at 11:08
The Variable exe contains only file name. I want to set the working directory where the file is present. And if the file is available in your working directly so you should be able to run exe only with name.
– Arkil Shaikh
Nov 15 '18 at 13:41
@mjwills - I have updated the question, given full working code and an example.Hope this will help.
– Arkil Shaikh
Nov 16 '18 at 4:42
add a comment |
It would be awesome if you could provide a Minimal, Complete, and Verifiable example, so we can see in code how you are calling that method (and with what parameters).
– mjwills
Nov 15 '18 at 11:08
With this line:FileName = exe
, doesexe
contain the full path to the file you want to start, or simply the file name? The Working Directory isn't used to execute the file
– Martin
Nov 15 '18 at 11:08
The Variable exe contains only file name. I want to set the working directory where the file is present. And if the file is available in your working directly so you should be able to run exe only with name.
– Arkil Shaikh
Nov 15 '18 at 13:41
@mjwills - I have updated the question, given full working code and an example.Hope this will help.
– Arkil Shaikh
Nov 16 '18 at 4:42
It would be awesome if you could provide a Minimal, Complete, and Verifiable example, so we can see in code how you are calling that method (and with what parameters).
– mjwills
Nov 15 '18 at 11:08
It would be awesome if you could provide a Minimal, Complete, and Verifiable example, so we can see in code how you are calling that method (and with what parameters).
– mjwills
Nov 15 '18 at 11:08
With this line:
FileName = exe
, does exe
contain the full path to the file you want to start, or simply the file name? The Working Directory isn't used to execute the file– Martin
Nov 15 '18 at 11:08
With this line:
FileName = exe
, does exe
contain the full path to the file you want to start, or simply the file name? The Working Directory isn't used to execute the file– Martin
Nov 15 '18 at 11:08
The Variable exe contains only file name. I want to set the working directory where the file is present. And if the file is available in your working directly so you should be able to run exe only with name.
– Arkil Shaikh
Nov 15 '18 at 13:41
The Variable exe contains only file name. I want to set the working directory where the file is present. And if the file is available in your working directly so you should be able to run exe only with name.
– Arkil Shaikh
Nov 15 '18 at 13:41
@mjwills - I have updated the question, given full working code and an example.Hope this will help.
– Arkil Shaikh
Nov 16 '18 at 4:42
@mjwills - I have updated the question, given full working code and an example.Hope this will help.
– Arkil Shaikh
Nov 16 '18 at 4:42
add a comment |
2 Answers
2
active
oldest
votes
The only way for this to work is for you to change your working directory to the passed in working directory before attempting to start the other process. The WorkingDirectory
property is just that, and doesn't in any way get involved in locating the executable to run. That just relies on your working directory and your PATH
environment variable, if you fail to provide a fully-qualified name.
static bool RunProc(string exe, string args, string workingDir)
{
var prevWorking = Environment.CurrentDirectory;
try
{
Environment.CurrentDirectory = workingDir;
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
}
};
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
finally
{
Environment.CurrentDirectory = prevWorking;
}
}
That works well.. I interpreted workingDirectory property wrong, Thank you so much for clarifying that. This has solved my problem.
– Arkil Shaikh
Nov 16 '18 at 14:16
if you can edit line 6 like Environment.CurrentDirectory = workingDir; would be better for other viewers.
– Arkil Shaikh
Nov 16 '18 at 14:19
@ArkilShaikh - done. Glad you got it even with the typo.
– Damien_The_Unbeliever
Nov 16 '18 at 14:20
add a comment |
Why not just call the .exe from the path where it is located directly ?
Process.Start(@"C:newfolderabcd.exe");
Or just put
proc.StartInfo.WorkingDirectory = @"c:newfolder";
before proc.start();
Thanks for the response. I can follow your first suggestion but the place I'm using this piece of code will have complex exe names, folder path and arguments, so it would be better to keep all these separate. I already tried your 2nd suggestion, that didn't work.
– Arkil Shaikh
Nov 15 '18 at 12:29
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317899%2funable-to-set-process-startinfo-workingdirectory-to-call-exe-from-c-sharp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The only way for this to work is for you to change your working directory to the passed in working directory before attempting to start the other process. The WorkingDirectory
property is just that, and doesn't in any way get involved in locating the executable to run. That just relies on your working directory and your PATH
environment variable, if you fail to provide a fully-qualified name.
static bool RunProc(string exe, string args, string workingDir)
{
var prevWorking = Environment.CurrentDirectory;
try
{
Environment.CurrentDirectory = workingDir;
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
}
};
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
finally
{
Environment.CurrentDirectory = prevWorking;
}
}
That works well.. I interpreted workingDirectory property wrong, Thank you so much for clarifying that. This has solved my problem.
– Arkil Shaikh
Nov 16 '18 at 14:16
if you can edit line 6 like Environment.CurrentDirectory = workingDir; would be better for other viewers.
– Arkil Shaikh
Nov 16 '18 at 14:19
@ArkilShaikh - done. Glad you got it even with the typo.
– Damien_The_Unbeliever
Nov 16 '18 at 14:20
add a comment |
The only way for this to work is for you to change your working directory to the passed in working directory before attempting to start the other process. The WorkingDirectory
property is just that, and doesn't in any way get involved in locating the executable to run. That just relies on your working directory and your PATH
environment variable, if you fail to provide a fully-qualified name.
static bool RunProc(string exe, string args, string workingDir)
{
var prevWorking = Environment.CurrentDirectory;
try
{
Environment.CurrentDirectory = workingDir;
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
}
};
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
finally
{
Environment.CurrentDirectory = prevWorking;
}
}
That works well.. I interpreted workingDirectory property wrong, Thank you so much for clarifying that. This has solved my problem.
– Arkil Shaikh
Nov 16 '18 at 14:16
if you can edit line 6 like Environment.CurrentDirectory = workingDir; would be better for other viewers.
– Arkil Shaikh
Nov 16 '18 at 14:19
@ArkilShaikh - done. Glad you got it even with the typo.
– Damien_The_Unbeliever
Nov 16 '18 at 14:20
add a comment |
The only way for this to work is for you to change your working directory to the passed in working directory before attempting to start the other process. The WorkingDirectory
property is just that, and doesn't in any way get involved in locating the executable to run. That just relies on your working directory and your PATH
environment variable, if you fail to provide a fully-qualified name.
static bool RunProc(string exe, string args, string workingDir)
{
var prevWorking = Environment.CurrentDirectory;
try
{
Environment.CurrentDirectory = workingDir;
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
}
};
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
finally
{
Environment.CurrentDirectory = prevWorking;
}
}
The only way for this to work is for you to change your working directory to the passed in working directory before attempting to start the other process. The WorkingDirectory
property is just that, and doesn't in any way get involved in locating the executable to run. That just relies on your working directory and your PATH
environment variable, if you fail to provide a fully-qualified name.
static bool RunProc(string exe, string args, string workingDir)
{
var prevWorking = Environment.CurrentDirectory;
try
{
Environment.CurrentDirectory = workingDir;
Process proc = new Process
{
StartInfo =
{
FileName = exe,
CreateNoWindow = true,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args,
}
};
proc.Start();
proc.StandardInput.WriteLine(args);
proc.StandardInput.Flush();
proc.StandardInput.Close();
return true;
}
finally
{
Environment.CurrentDirectory = prevWorking;
}
}
edited Nov 16 '18 at 14:19
answered Nov 16 '18 at 7:35
Damien_The_UnbelieverDamien_The_Unbeliever
196k17253340
196k17253340
That works well.. I interpreted workingDirectory property wrong, Thank you so much for clarifying that. This has solved my problem.
– Arkil Shaikh
Nov 16 '18 at 14:16
if you can edit line 6 like Environment.CurrentDirectory = workingDir; would be better for other viewers.
– Arkil Shaikh
Nov 16 '18 at 14:19
@ArkilShaikh - done. Glad you got it even with the typo.
– Damien_The_Unbeliever
Nov 16 '18 at 14:20
add a comment |
That works well.. I interpreted workingDirectory property wrong, Thank you so much for clarifying that. This has solved my problem.
– Arkil Shaikh
Nov 16 '18 at 14:16
if you can edit line 6 like Environment.CurrentDirectory = workingDir; would be better for other viewers.
– Arkil Shaikh
Nov 16 '18 at 14:19
@ArkilShaikh - done. Glad you got it even with the typo.
– Damien_The_Unbeliever
Nov 16 '18 at 14:20
That works well.. I interpreted workingDirectory property wrong, Thank you so much for clarifying that. This has solved my problem.
– Arkil Shaikh
Nov 16 '18 at 14:16
That works well.. I interpreted workingDirectory property wrong, Thank you so much for clarifying that. This has solved my problem.
– Arkil Shaikh
Nov 16 '18 at 14:16
if you can edit line 6 like Environment.CurrentDirectory = workingDir; would be better for other viewers.
– Arkil Shaikh
Nov 16 '18 at 14:19
if you can edit line 6 like Environment.CurrentDirectory = workingDir; would be better for other viewers.
– Arkil Shaikh
Nov 16 '18 at 14:19
@ArkilShaikh - done. Glad you got it even with the typo.
– Damien_The_Unbeliever
Nov 16 '18 at 14:20
@ArkilShaikh - done. Glad you got it even with the typo.
– Damien_The_Unbeliever
Nov 16 '18 at 14:20
add a comment |
Why not just call the .exe from the path where it is located directly ?
Process.Start(@"C:newfolderabcd.exe");
Or just put
proc.StartInfo.WorkingDirectory = @"c:newfolder";
before proc.start();
Thanks for the response. I can follow your first suggestion but the place I'm using this piece of code will have complex exe names, folder path and arguments, so it would be better to keep all these separate. I already tried your 2nd suggestion, that didn't work.
– Arkil Shaikh
Nov 15 '18 at 12:29
add a comment |
Why not just call the .exe from the path where it is located directly ?
Process.Start(@"C:newfolderabcd.exe");
Or just put
proc.StartInfo.WorkingDirectory = @"c:newfolder";
before proc.start();
Thanks for the response. I can follow your first suggestion but the place I'm using this piece of code will have complex exe names, folder path and arguments, so it would be better to keep all these separate. I already tried your 2nd suggestion, that didn't work.
– Arkil Shaikh
Nov 15 '18 at 12:29
add a comment |
Why not just call the .exe from the path where it is located directly ?
Process.Start(@"C:newfolderabcd.exe");
Or just put
proc.StartInfo.WorkingDirectory = @"c:newfolder";
before proc.start();
Why not just call the .exe from the path where it is located directly ?
Process.Start(@"C:newfolderabcd.exe");
Or just put
proc.StartInfo.WorkingDirectory = @"c:newfolder";
before proc.start();
answered Nov 15 '18 at 11:29
John LinaerJohn Linaer
54
54
Thanks for the response. I can follow your first suggestion but the place I'm using this piece of code will have complex exe names, folder path and arguments, so it would be better to keep all these separate. I already tried your 2nd suggestion, that didn't work.
– Arkil Shaikh
Nov 15 '18 at 12:29
add a comment |
Thanks for the response. I can follow your first suggestion but the place I'm using this piece of code will have complex exe names, folder path and arguments, so it would be better to keep all these separate. I already tried your 2nd suggestion, that didn't work.
– Arkil Shaikh
Nov 15 '18 at 12:29
Thanks for the response. I can follow your first suggestion but the place I'm using this piece of code will have complex exe names, folder path and arguments, so it would be better to keep all these separate. I already tried your 2nd suggestion, that didn't work.
– Arkil Shaikh
Nov 15 '18 at 12:29
Thanks for the response. I can follow your first suggestion but the place I'm using this piece of code will have complex exe names, folder path and arguments, so it would be better to keep all these separate. I already tried your 2nd suggestion, that didn't work.
– Arkil Shaikh
Nov 15 '18 at 12:29
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317899%2funable-to-set-process-startinfo-workingdirectory-to-call-exe-from-c-sharp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It would be awesome if you could provide a Minimal, Complete, and Verifiable example, so we can see in code how you are calling that method (and with what parameters).
– mjwills
Nov 15 '18 at 11:08
With this line:
FileName = exe
, doesexe
contain the full path to the file you want to start, or simply the file name? The Working Directory isn't used to execute the file– Martin
Nov 15 '18 at 11:08
The Variable exe contains only file name. I want to set the working directory where the file is present. And if the file is available in your working directly so you should be able to run exe only with name.
– Arkil Shaikh
Nov 15 '18 at 13:41
@mjwills - I have updated the question, given full working code and an example.Hope this will help.
– Arkil Shaikh
Nov 16 '18 at 4:42