A written program in an exe file. Creating an EXE file

We'll consider creation.exe using the py2exe module library. This requires Python 3.4 and below.

If you have a higher version of Python installed, try using (below)

In this example we will look at creating .exe using an example Python3.4.

First of all, you need to create a virtual environment for Python3.4. In this example we'll call it myenv. You can choose any other name, but don't forget to make the appropriate changes.

On the terminal, type the following commands:

>py -3.4 -m venv myenv > myenv\Scripts\activate.bat

The prefix will appear on the command line myenv, which means that the virtual environment named myenv is loaded. All teams Python will now use the new virtual environment.

Now let's install py2exe(https://pypi.python.org/pypi/py2exe~~HEAD=dobj) in our virtual environment:

>pip install py2exe

And finally, to create a single EXE file, in our virtual environment we run the command:

>python -m py2exe.build_exe hello.py -c --bundle-files 0

(replace hello.py to the name of your script. If the script is in a different folder, then you need to use the full path to your script, for example, C:\Projects\Python\hello.py). This will create a DIST folder that contains the executable file. To quickly access it, type in the terminal:

> explorer dist

You will see the path to the folder where the EXE file is located.

Note: When executed, a window will open and disappear as quickly as it appeared.
This happens because the operating system automatically closes the terminal in which the console program is finished.
In order to change this situation, you can add the line

> input ("Click to exit...")

at the end of the file Python. The interpreter will wait for user input and the window will remain open until the user presses enter.

You can study the usage in detail py2exe in the documentation on the module page: https://pypi.python.org/pypi/py2exe
Exiting the virtual environment is done with the command

>deactivate

Method 2

Install pyinstaller via the Windows command line:

> pip install pyinstaller

On the command line, go to the folder where the file is located

Cd c:\...

Then on the command line we type the command

Pyinstaller --onefile example.py

Instead of exapmle.py use the name of the file from which you want to create the exe file.

In a couple of minutes everything is ready! Most likely, the exe file will be located in the created subfolder dist

Content
1.How to compile EXE
1.1 Compilation technology
1.2 Related files
2.What needs to be included in the EXE

1.How to compile EXE
1.1 Compilation technology
Epigraph:
"Oh yes Pushkin, oh yes..."
A.S. Pushkin

The technology for compiling EXEs in Visual FoxPro is quite simple. We will not be distracted by such extreme methods as entering commands like BUILD PROJECT, BUILD APP, BUILD EXE , but we will limit ourselves to the conveniences provided by the VFP graphical interface.
So, to create an EXE we need to click the button in the project manager "BUILD...". By selecting the option in the dialog box that opens Win32 executable/COM server (EXE) we press OK. ALL. ;-)
“How is everything?” - you ask - “How about what name to save the file under?”
I agree... It is necessary to indicate, otherwise everything will be in vain.
By the way, I think it would be useful to remind you that in order for the compilation process to be successful, you need to fill the project manager with files of your program, one of which must be as main (in the project manager the name of this file is in bold), i.e. . the file that will be executed first. By default, the first program file (*.prg) or form file (*.scx) included in the project is installed as the main program.
In general, everything is quite simple! Just..?
Now about the sad...

1.2 Related files
Epigraph:
"...and when you turn it on, it doesn't work!"
M. Zhvanetsky

All the hassles of the application compilation stage are already over, and you, proud of the awareness of your own superiority over mere mortals, rush by leaps and bounds to the customer, install your application, simultaneously describing to him (the customer) how cool everything will be for him now, and counting in your mind which screw you need to buy something to have leftover for beer, suddenly you come across the fact that your super-duper program doesn’t make any money. Sad. It's a shame. And most importantly, you won’t have a new hard drive or whatever you planned to buy from your fee...

The thing is that the .exe we compiled is not a self-contained executable file. This pseudo-executable requires support libraries (.dlls) to function properly. I won’t go into much detail about this, but will simply give the names of the files necessary for the application to work properly.
In principle, up to version 6 inclusive, you can use the standard one to transfer the application to the client machine. Setup Wizard, which independently prescribes everything, and in subsequent ones - InstallShield(or another installer).
All the files below are the minimum required set of files for different versions of VFP (based on materials):

VFP 8.0 msvcr70.dll, vfp8r.dll, vfp8rrus.dll, gdiplus.dll VFP 7.0 msvcr70.dll, vfp7r.dll, vfp7rrus.dll VFP 6.0 vfp6r.dll, vfp6renu.dll, vfp6rrus.dll VFP 5.0 vfpole50. dll, vfpodbc .dll, vfp500.dll, vfp5rus.dll, Foxpro.int
The above set of libraries must be placed in the program directory or in the Windows system directory. These directories are different for different versions of Windows:

Win9x, WinMe c:\Windows\SYSTEM WinNT,Win2000,WinXP c:\Windows\SYSTEM32

2.What needs to be included in the EXE
Epigraph:
"To include or not to include?"
drunk electrician

Everything stated below is the personal opinion of the author, which you can ignore. But when doing it your way, remember: banging your head into a concrete wall is much more painful than taking advantage of a break made before you.
By default, the finished .exe includes all the files necessary for the application to work - programs, forms, menus, libraries, classes, etc. except for database and table files (such files can be identified by the crossed out circle next to the file name in the project manager). All files included in the .exe will become unmodifiable (read-only) after compilation. It is clear that table files (*.dbf) should not be included since they are subject to constant operations of changing and adding data, but sometimes there are cases when it is necessary to hide some static data from the user, but provide access to it by the program itself. I can’t think of a better place than the “insides” of an exe-man.
It is also quite a common situation when you need to “find”, or temporarily, change a report file, or when you have a whole set of reports that are unique for each user. Well, really, imagine: ten operators and ten reports each, and all this in *.exe. The only solution in this situation is to exclude these reports from the final file and supply them with the application.
In any case, the decision about which files to exclude and which to leave is up to you.

That's it, the beer is over, we need to go to the grocery store.

Best regards, Vladislav Kulak

Recently I encountered a problem. We were assigned a course project, I did everything perfectly, but all that remained was to make the installation file, namely the .exe file.

The teachers gave us a very illegible program, but one smart person recommended another, which is called Smart Movie Maker. He said that he had never seen an easier program for this task.

You will see a window like this:

As you can see, the left side of the window is divided into two parts: Installer And Uninstaller.

As you already understood in the part called Installer there will be settings specifically for your installation file and in part Uninstaller accordingly, the settings for the file that will delete your program.

What will I tell you about the main characteristics for the installation file.
As you have already noticed, the .exe file has quite a lot of parameters. Let's talk a little about each.

Information:
You could see it immediately when you launched the program. I think everything is clear there, what needs to be entered Program name, Version etc. I will only talk about the main ones.

Fill out all the headings and inscriptions too, because you will see all this when installing the program.

Compression type you can choose Maximum, because this will reduce the size of your installation file. And Breakdown type you can choose one file, it will be easier for the user.

Files:

I also marked the plus sign in the screenshot. By clicking on it, you must select the files that will be unpacked when installing the program, select only the main files of the program, you do not need to shove anything extra there.

Requirements:


At this point you need to indicate the requirements for your program. For example, the type of OS or additional software that must be installed on the computer.

Dialogues:


This window has four tabs: General, License/Information, Password And Completion. Dialogs are additional windows or items that will appear. For example, a window about the license agreement.

Interface:


Here you can design your installation window. Select the top or central part of the menu, change the program icon and everything related to the program’s graphical interface.

In principle, these are all the main points that are required for the installation file.

And now to finish, to finally create the file itself, just click the button Compile.

As you can see, the program interface is very simple and intuitive. So use it, I hope it will help you, as it helped me.

Surely many of you at least once in your life have come across an archive with the extension .exe, not rar or even zip, but exe. The beauty of this archive is that it is self-extracting and does not require the installation of additional programs. Many people think that in order to create this kind of archive, some specific knowledge or programs are required, but I can assure you that this is not the case. EXE archives are created using one of several most popular archivers: WinRar and WinZip.

You probably have one of these two archivers installed on your computer, so you can safely start practicing right away. If there is no archiver at all, then you can safely install 7-zip, because it is free and freely distributed on the Internet. We will start with this archiver.

And so, prepare the folder with the files that need to be archived and right-click on it. We find an item such as 7-Zip

Another submenu pops up from which we must select the item "Add to archive..."

A window opens, look for the “Options” section, in the options the item “Create SFX archive” We place a bird opposite it. Now we pay attention to the topmost field, where the name of our future archive is. We have added an exe extension. By the way, the name of the archive can be changed. You can also specify the location where you want to save it. In principle, you can play around with the other options, but they do not affect the archive type. You can set the maximum compression level to keep the archive size as small as possible.

Now you can click on the “OK” button.

This is the file I got on my desktop:

Now let's figure out how to create exactly the same archive, but using WinRar.

In the same way, right-click on the folder and select "Add to archive":

In the window that opens, in the “General” tab, you need to in the section "Archive Options" put a bird next to the item “Create SFX archive”. Let's install some compression method. I chose "Good".

Click on the “OK” button.

The result is the following archive:

So we looked at several ways to how to create a self-extracting exe archive.

And also watch a video on the topic:

Rate this article:

Content:

From this article you will learn how to create a simple EXE file on a Windows computer, as well as how to create an exe container that can be used to run the executable file on another computer. EXE files are used to install programs or add files to a Windows computer. To create an EXE file, you must use the IExpress system utility.

Steps

Part 1 How to create an EXE file

  1. 1 Open the Start menu.
  2. 2 In the Start menu search bar, type notepad. This will take you to the Notepad program.
  3. 3 Click the Notepad program icon. It looks like a blue notepad and is located at the top of the Start menu.
  4. 4 Enter the program code for the file. Enter the code line by line or copy and paste it into Notepad (if you already have the code ready).
    • If you don't know how, ask someone else to do it.
    • Also, program codes for simple EXE files can be found on the Internet.
  5. 5 Click File. This menu is located in the upper left corner of the Notepad window. A drop-down menu will open.
  6. 6 Click Save As. This option is in the File drop-down menu.
  7. 7 Open the File Type drop-down menu. You will find it at the bottom of the window.
    • The current File Type menu option should be Text Documents (*.txt).
  8. 8 Click All Files. This option is in the drop-down menu.
  9. 9 Enter a name for the EXE file. In the File Name line, enter a name and then enter the extension .exe . This will save the file as an EXE file.
    • For example, if the file name is "bananas", enter bananas.exe.
  10. 10 Select the folder where the EXE file will be stored. To do this, click on the appropriate folder on the left side of the window.
  11. 11 Click Save. This button is located in the lower right corner of the screen. This will save the EXE file in the selected folder.

Part 2 How to create an installation EXE file

  1. 1 Open the Start menu. To do this, click on the Windows logo in the lower left corner of the screen.
  2. 2 In the Start menu search bar, type iexpress. This is how you will find this utility.
    • Enter the word iexpress in full.
  3. 3 Click on the iexpress utility icon. It looks like a gray cabinet and is located at the top of the Start menu.
  4. 4 Check the “Create new Self Extraction Directive file” option. It's in the middle of the page. This option should be checked by default; otherwise, highlight it.
  5. 5 Click Next. This button is in the lower right corner of the window.
  6. 6 Check the “Extract files only” option. It's in the middle of the page.
  7. 7 Click Next.
  8. 8 Enter the name of your EXE file. Do this in the text box in the middle of the window and then click Next.
  9. 9 Think about a prompt box. If you want the user to confirm that they want to run the EXE file, check the “Prompt user with” option and enter the confirmation request text. Otherwise, click Next.
    • When the user runs the EXE file, a window will open with the text you entered (if you selected the request option).
  10. 10 Think about the license agreement window. If you want the license agreement to be displayed on your screen, check the "Display a license" checkbox, then click "Browse" to select the document containing the license agreement, and then click "Open." Otherwise, click Next.
  11. 11 Click Add. This button is located in the lower middle part of the window. A new Explorer window will open in which you can select the files that will be included in the installation EXE file.
    • The files included in the installation EXE file will be installed when the user runs the EXE file.
  12. 12 Select the files to be included in the EXE file. Click on the file folder on the left side of the Explorer window, and then select the files you need; To do this, hold down the left mouse button and drag the cursor over the desired files.
    • You can also select files one by one; To do this, hold down ^ Ctrl and click on each file you need.
  13. 13 Click Open. This button is in the lower right corner of the window. This will add the files to the installation EXE file.
    • If you need to add more files, click “Add” again and repeat the process.
  14. 14 Click Next.
  15. 15 Check the "Default" option and then click Next. It is located at the top of the window.
  16. 16 Consider a closing message box. This message appears on the screen after the installation process of the EXE file is completed. Check the "Display message" option, then enter the text of the message, and then click "Next."
    • If you do not want the final message to appear on the screen, simply click Next.
  17. 17 Add the program you want to install. This is a program in an EXE file that was created earlier. Click Browse, open the folder containing the file, click on it and click Save.
    • If you want, check the "Hide File Extracting Process Animation from User" option to make the installation file run without unnecessary visual effects.
  18. 18 Click Next three times. An installation EXE file will be created. The time required for this process depends on the number of files you included in the installation EXE file.
  19. 19 Click Finish. This button is at the bottom of the window. The installation EXE file will be saved and ready for use.
  • You don't need an EXE setup file to run the EXE file, but the EXE setup file will install the EXE file and any supporting items (such as the ReadMe file, folders, and so on).

Warnings

  • If you don't know how to code an EXE file, ask someone who knows how to code.