

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 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.