Log in

View Full Version : [?] how to make a simple exe file


bert8for3
01-14-11, 04:33 PM
I just want to make a simple exe file to copy the contents of one folder to another folder using syntax copy C:\folderA\*.* C:\folderB

Used to be ya just had to put that in a text file and rename the extension from txt to exe or even bat. Now it doesn't work and my Notepad doesn't give any option to save as an exe file (which I've read you can do).

Could be my operating system, I suppose. Am running Win XP Pro SP3 AFAIK 32-bit. Could also be because my knowledge of anything to do with this goes back to DOS days.

Appreciate if someone could tell me if/how to do this.

Feuer Frei!
01-14-11, 07:02 PM
Notepad saves in ANSI by default. It can't save in binary. EXE's need to be saved in binary form. You will need a compiler/ decoder.
.bat files can be created using notepad, just make sure you aren't saving as a .txt file.

Example:
start /d C:\Windows\System32\calc.exe
start /d "C:\Program Files\Mozilla Firefox" firefox.exe
start /d "C:\Program Files\Microsoft Office\Office12" EXCEL.EXE

this will just open Excel, Calculator and Firefox

The above command, start tells Windows to open a separate window to run the specified program.
The /d switch tells start command the path of the program. For starting Excel and Firefox, notice that the paths are in quotes, which is needed when there is a space in the file path.
To create batch files in notepad, make sure also when you copy file and folder paths that have spaces, to use quotes.
I don't know if this helps.

CaptainHaplo
01-14-11, 09:39 PM
Actually - with a bat file - you do want to save as a text file. Make sure you save it in a text format (not rich text) and then just change the file extension to .bat

doubleclick the file and your done.

Or - if your old school... you can use the copy con (Filename.ext) command and write it the prehistoric way

Jan Kyster
01-15-11, 05:23 AM
Erh... in NotePad you simply choose "Save as..." and then type filename.bat

No need for a rename then.


Of course we old DOS folks all use EdLin...? :shifty:

bert8for3
01-15-11, 09:28 AM
Thanks everyone. I had spaces in the file path and didn't use quotemarks. Darned file and folder (I still call them directory, although not so often anymore) names should be limited to what was it ... 8 characters? :haha: Thanks again.