I've tried to convert an old .bat script that needs to be ran for another propriatary system into c#, given I know more C# than I do bash. The gist of this is that it prints out some functions from systeminfo into a plain text file disguised as a propriatary filetype. (Having opened them, they are litterally just .txt's renamed.)
My current .bat code looks like this (Horribly inefficient, but still);
del %USERPROFILE%\documents\systeminfo_nm.ncf
echo CUR INF SET - DO NOT MODIFY>>"%USERPROFILE%\documents\systeminfo_nm.ncf"
systeminfo | find /I "OS Version">>"%USERPROFILE%\documents\systeminfo_nm.ncf"
systeminfo | find /I "BIOS Version">>"%USERPROFILE%\documents\systeminfo_nm.ncf"
systeminfo | find /I "System Model">>"%USERPROFILE%\documents\systeminfo_nm.ncf"
systeminfo | find /I "Time:">>"%USERPROFILE%\documents\systeminfo_nm.ncf"
systeminfo | find /I "Original">>"%USERPROFILE%\documents\systeminfo_nm.ncf"
And this gets parsed to an external func. - HOWEVER! This will not work, as we are phasing out ALL .bat scripts, and they need to be turned into .exe's as my usual converting tool to exe just packs it up and disguises it, but it gets blocked once it unpacks the .bat, and the only other way I know how to do that is to write it out in C# code.
Currently my C# code looks as such - however C# keeps trying to read these lines as code, and not as the text it is supposed to parse to the CMD module:
static void Main(string[] args)
string strCmdTextOne;
strCmdTextOne = @"systeminfo | find /I @"OS Version">>@"%USERPROFILE%\documents\systeminfo_nm.ncf"";
string strCmdTextOne;
strCmdTextOne = @"systeminfo | find /I @"BIOS Version">>@"%USERPROFILE%\documents\systeminfo_nm.ncf"";
System.Diagnostics.Process.Start("CMD.exe", strCmdTextOne, strCmdTextTwo);
Is there a way for me to escape this, or maybe run the commands all on the same systeminfo command, to optimize it too, if that is possible?
In the end, all I really need is for it to run in a standalone c# .exe rather than a .bat