Greetings,
I want to know simply how to create a batch file from .exe file?
Thank you.....
Greetings,
I want to know simply how to create a batch file from .exe file?
Thank you.....
If you mean you want to create a new batch file from an unrelated existing executable file (in other words, the batch file does something different), you do it the way you create any file. In C, you'd use fopen
, fwrite
and fclose
to create your new file and write whatever batch file commands you want to it.
If you mean you want to create a batch file that "intercepts" your exe file, you can do that too. If your executable file is pax.exe
, you can simply rename it to pax2.exe
and create a batch file called pax.cmd
thus:
@echo off
pax2.exe
This will allow you to do arbitrary actions before and after your executable runs but there are things to watch out for such as executables that return control before they're actually finsihed.
If, however, you're talking about converting an arbitrary executable into a batch file that performs the same task, that's much more difficult. Unless you have the source code or a very good specification on how the executable works, you're going to have a lot of trouble.
Automating the conversion for anything but the simplest executable will be insanely difficult.
And, if you want a link to a batch file that runs your executable, just create the batch file (say in c:\bin\pax.cmd
) containing:
@echo off
c:\bin\pax.exe
and then create a shortcut to it from wherever you want (such as the desktop). You could even put the batch file itself in your desktop directory but I'm not a big fan of that. However, to each their own.
simply use notepad.exe
load a note pad. write anything let say '@echo off'
Save it! with filename sample.bat :)
whatever you do in the CMD.Exe or commandline you can write it also as a batch file
example
goto menu->run type cmd.exe
type dir/w
as you can see it display the content of the current drive\folder.
See dos commands there are sample of basic usage of it. @echo off means hiding the output message on the screen. so its better not to use it when procticing so that you could see whats happing
examples sample.bat
cd\
md hello
cd hello
notepad.exe
as you can see you created a 'hello' folder on your drive C: and notice notepad.exe executed. take note that notepad.exe is in the windows directory wich inclue on the windows path. so if you want to execute file wich is not in the windows path, then you must include the filename path ex: c:\bin\your.exe