Trying to run export command through C# process :
Process proc = Process.Start("export", "display=\":0.0\"");
Part of the error
System.ComponentModel.Win32Exception: Cannot find the specified file
at System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>: 0
This is the way I did for all the commands and it always worked.
Process proc = Process.Start("kill", "810");
So why is it not working for export command?
Best How To :
kill is a shell built-in and a binary on the system so it can be run without a shell.
$ type -a kill
kill is a shell builtin
kill is /bin/kill
kill is /usr/bin/kill
export is a shell-builtin only so you can't run
export without a shell.
$ type -a export
export is a shell builtin
Additionally, even if you did get
export to run like that it would only have an effect for the shell it ran in and not for your main process or any other processes run via
To set an environment variable that will be available to the current process and to other spawned processes later you need to modify the environment of the current process directly (via C#).