Is there any solutions to close cmd window when run a .exe file? - exe

I have a .exe file in my application that is converted from .py file through pyinstaller. When I run that .exe file, there shows a cmd window. And what I want is to close that window.
Can everyone give me a solutions?
Thanh you.

Related

I can use the command line to run a .pyw file with pythonw, but the same file will not run when using "open with" -> "pythonw"

I have a python script that runs successfully, with no errors or outputs to stderr or stdout, when run with pythonw from the console.
However, if I try to open that script from file explorer using pythonw, it will exit in a few milliseconds.
I am using Windows 11, python 3.9.0.
A command such as "pythonw script.pyw" will work from the console, but the file can't be opened directly.
There is a windows menu where you can select a default app per each filetype. I believe you could add the pythonw .exe file as the default app for .pyw files.
Hope this might help you
https://answers.microsoft.com/en-us/windows/forum/all/making-a-file-open-with-a-specific-program/9527cd74-565f-4331-a0e4-10e0a4cd618d

Pyinstaller creates x-sharedlib file in pop os

I use Pyinstaller in pop os for a python script but it creates a x-sharedlib file that I can only open through terminal. I tried to rename it to exe and run it but nothing happens. How I can make it open by double click? Thank you!
Found the solution. I renamed it to .sh changed nautilus preferences to run executable text files and runs normally now.

pyinstaller --onefile doesn't copy necessary file

Recently I've made a GUI application with PyQT5 in python3 and this app is included Images and musics.
my source code run properly, but when I use this command :
pyinstaller --onefile GUI.py
to make .exe file, my application doesn't run properly and when I copy the Images and musics beside my .exe it works properly.
I want to know how can I to make .exe with pyinstaller with my data files in it and I want that my data file's isn't shown at all.
Add file directory in the file GUI.spec following instructions here
Then delete all the folders created by pyinstaller, EXCEPT GUI.spec
Type in terminal: pyinstaller GUI.spec
(notice: this time .spec, not .py)

Get the filepath which open with electron app

I am building a text editor with electron, and I want to open files with my text editor, lik some file open with my editor or double click to open file,
I fixed it for windows using process.argv because when some file open with electron it save thr path of file in command line arguments process.argv,
But the same thing is not working for linux or mac, so could some one help me to get this working for linux or mac.
First, you have to add file associations to your project / Windows: Node File Associations
Then, you can access it with process.argv1 in your main.js.
Maybe this can help you: Electron process.argv

replacement of system() to run an .exe file which does not open cmd window in background

I am having visual studio 2005 and win 7 installed in my system. In c++ I am downloading an .exe from my local server using URLDownloadToFile(). After downloading I need to run this .exe file. I am able to do this using system("path to the .exe file") but it opens a cmd window in background. Can anybody tell me what other method can I use to replace system() which doesn't opens a cmd window in background.
I had also given try to following methods
1. ShellExecute(NULL,(LPCWSTR) "explore",(LPCWSTR) "C:/Users/ay\\AppData/Roaming/path-here/file.exe", NULL, NULL, SW_SHOWNORMAL);
2. LPTSTR szCmdline = _tcsdup(TEXT("C:\\Users\\ay\\AppData\\Roaming\\path-here\\file.exe -L -S"));
CreateProcess(NULL, szCmdline,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
But none of these command can start running my .exe file. Thanks in advance.
Once the downloaded successfully then try the following solution.
CString exeFileName;
ShellExecute(NULL, _T("open"), exeFileName.GetBuffer(), NULL, sExePresentInDirectory, SW_SHOWNORMAL);
exeFileName.ReleaseBuffer();
I have tried, It works fine.
For more help please refer this.

Resources