#Run a Linux file in C Sharp

1 messages · Page 1 of 1 (latest)

latent cradle
#

good day.
i tried this code:

        private void startFile() {
            try {
                Process process = new Process();
                process.StartInfo.FileName = "/home/crashdummybot/reload";
                process.Start();
            } catch (Exception ex) { Console.WriteLine(ex.ToString()); }
        }

but i get the error:

System.ComponentModel.Win32Exception (8): An error occurred trying to start process '/home/crashdummybot/reload' with working directory '/home/crashdummybot'. Exec format error
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at CrashDummyBot.Program.startFile() in C:\Users\info\source\repos\CrashDummyBot\CrashDummyBot\Program.cs:line 73

any solutions to this?

sly crater
#

Are you sure the file path is correct ? I dont know maybe include file extension. And i remember i had some issue with Directory separator make sure you use correct one.

latent cradle
#

i solved it, the run file just missed #!/bin/bash