So I tried to make a program in C# that connects two .exe files by IExpress command but it throws an error in the title of the thread.
Code that seems to not work:
StreamWriter sw = new StreamWriter(File.OpenWrite(@$"{workdir}\script.sed"));
sw.Write($"[Version] \nClass=IEXPRESS \nSEDVersion=3 \n[Options] \nPackagePurpose=InstallApp \nShowInstallProgramWindow=0 \nHideExtractAnimation=1 \nUseLongFileName=1 \nInsideCompressed=0 \nCAB_FixedSize=0 \nCAB_ResvCodeSigning=0 \nRebootMode=I \nInstallPrompt=%InstallPrompt% \nDisplayLicense=%DisplayLicense% \nFinishMessage=%FinishMessage% \nTargetName=%TargetName% \nFriendlyName=%FriendlyName% \nAppLaunched=%AppLaunched% \nPostInstallCmd=%PostInstallCmd% \nAdminQuietInstCmd=%AdminQuietInstCmd% \nUserQuietInstCmd=%UserQuietInstCmd% \nSourceFiles=SourceFiles \n[Strings] \nInstallPrompt= \nDisplayLicense= \nFinishMessage= \nTargetName={Path.GetFileNameWithoutExtension(file)}+wpkg2.exe \nFriendlyName=All your SEDs are belong to us \nAppLaunched={Path.GetFileName(file)}\nAppLaunched2=wpkg2.exe\nPostInstallCmd=<None> \nAdminQuietInstCmd= \nUserQuietInstCmd= \nFILE0=wpkg2.exe\nFILE1={Path.GetFileName(file)}\n[SourceFiles]\nSourceFiles0={Path.GetDirectoryName(file)}\nSourceFiles1={workdir}\n[SourceFiles0]\n%FILE1%=\n[SourceFiles1]\n%FILE0%=");
sw.Close();
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = @"C:\Windows\System32\iexpress.exe";
startInfo.Arguments = @$"/N {workdir}\script.sed";
process.StartInfo = startInfo;
//startInfo.UseShellExecute = true;
//startInfo.Verb = "runas";
process.Start();
I tried to execute the command as administrator but it did not work too. (The code that is commented is the code I tried to use to execute command as administrator)
I found that when you run
IExpress.exefrom the command line using the/Noption, it will display that error if the path to the SED file contains spaces. It will display the error whether or not you surround the file path in quotes. I'm only aware of two workarounds: