
So if you were to compile a script on Win 98, and run on Win 8.1, you'd get unexpected results or scripts may not even work.įor this reason, one would need a different compiler on each version of Windows, preferably which would spit out binary code (generic) that can be run on as many CPU chips as possible, with same instruction sets. See this link for different commands for restarting different versions of windows: findstr and shutdown.īTW, Win 10 CMD doesn't allow changes to SETLOCAL on command line. Launching MySuperApp.exe will call MySuperApp.bat (the bat-file with the same name).Ĭsc.exe (should?) be present on every Windows machine.ĭifferent versions of Windows has different effects for same batch file commands, and some commands are limited to some Windows systems eg. If you store this code above to MySuperApp.cs just next to MySuperApp.bat and then compile it with csc.exe /target:winexe MySuperApp.cs (and maybe even add /win32icon:MySuperApp.ico to add a fancy icon) it will generate a MySuperApp.exe. Var batchContent:byte= File.ReadAllBytes(arguments) įor (var i=0 i NET compilers (again should be available on almost every win machine).I've choose. So one other possible approach is to look at the. This should work practically on every Windows machine out there but has one major limitation - you cannot pass arguments to the created. (echo()>"%temp%\d"Įxample: bat2exeIEXP.bat myBatFile.bat MyExecutable.exe (echo(TargetName=%target.exe%)>"%temp%\d" (echo(AppLaunched=cmd.exe /c "%bat_name%")>"%temp%\d" echo usage: %~nx0 batFile.bat target.Exe bat file you want to convert and the target executable: off So here's IEXPRESS sed-directive/.bat file that creates a self-extracting. One very obvious approach is to use IEXPRESS - the ancient built-in tool that creates self-extracting packages and is capable to execute post extraction commands.