Creating an EXE from python results in command prompt opening - pyqt5

This is my first attempt with PyQT5 and pyinstaller. I am using a simple command to launch httpd.exe from a button click
The command I use is
os.system(cur_dir+"//htdocs//api//taskkill /f /im httpd.exe")
It starts apache web server minimized and works fine. Apache starts and there is no command prompt window opening. When I create the exe via pyinstaller, I get a command prompt window flash when I click on this button. Is there a way to prevent that command prompt window from opening? I am using pyinstaller --onefile --windowed

Use the --noconsole option to get rid of command prompt window.
pyinstaller --onefile --windowed --noconsole

Related

How to keep weblogic running after closing putty window

I’ve started weblogic through putty:
./startWebLogic.sh
After that server started successfully.
But when I close the putty window, the server stops working
How can I keep weblogic running after I close the putty window?
Thanks!
You will want to use something like the following:
nohup ./startWebLogic.sh &
Nohup is a unix command, used to start another program, in such a way that it does not terminate when the parent process is terminated.
You can also output it to a file if you'd like:
nohup ./startWebLogic.sh > admin_server.out &
Simple Steps:
after the login through putty follow the below steps:
Go directory of server where "startWebLogic.sh" this command located.
typed command "screen" press enter (A new Screen will opened)
In the new screen type your run command "./startWebLogic.sh".
Press Ctrl+a then press d(without holding Ctrl) you will return back previous screen)
if like to go again your server log screen typed command "screen -r"
Akbar

cmd.exe will not recognize command

I have a vb.net application that runs cmd.exe as the following:
Dim Port1 = CreateObject("WScript.Shell")
Port1.Run("cmd.exe")
Port1.Sendkeys("telnet ip address")
Port1.Sendkeys("{Enter}")
System.Threading.Thread.Sleep(6000)
When the cmd runs the sendkeys a error shows
"'telnet' is not recognized as an internal or external command,
operable program or batch file."
I closed the cmd window, opened another cmd, and typed in the command with not problems.
I need cmd to run in the vb.net and not as a separate file.
Running the vb.net in Microsoft visual studio Ultimate 2013.
Update: Can anyone tell me why it is doing the same thing when i move the app to another computer and try to run it?
You have to enable telnet on the computer by going to start > control panel > programs and features > turn windows feature on or off > check telnet client or typing optionalfeatures in run and checking telnet client. The command should execute successfully after that.
Either Telnet is not installed on your computer (it's not installed by default on any modern Windows versions as far as I know), or it its installation directory not in the PATH environment variable.
Either add it's install directory to PATH, or specify the full path to telnet.exe in the arguments to cmd.exe.
CMD runs commands based off of System32 and .bat(batch) or .exe. You would have to create a .exe or a .bat and place it into System32 in order for the command to work.

Executing command in Plink from a batch file

I want to automate the export process which I take using expdp command in Oracle.
Following is the contents of batch file I have created to open PuTTY.
#echo off
"C:\Program Files\PuTTY\plink.exe" username#Ip_Addr -pw password -m Open_Putty.txt`
Following is the contents of Open_Putty.txt to execute different commands.
echo $ORACLE_SID;
Read oraenv;
But after opening Open_Putty.bat it disappears without showing any output.
Please help me with this. I want to set oraenv and run some more commands to take the backup.
It's unlikely that plink.exe disappears without showing any output. I assume you execute the batch file from a Windows Explorer or other GUI application, so the Plink console window disappears once Plink finishes (possibly with error) and you cannot read the output (error).
Make sure you execute plink.exe from a console window (typically a cmd.exe) or add pause command to the end of the batch.
Make sure Plink can find the script file (Open_Putty.txt). As you do not specify a path to the file, it has to be located in your current working directory. Safer is to use a full path to the script file:
"C:\Program Files\PuTTY\plink.exe" username#Ip_Addr -pw password -m "C:\path\Open_Putty.txt"
The backtick symbol at the end of the command should probably not be there.
The name "Open PuTTY" is bit confusing. You are not using PuTTY at all. And even if you refer to Plink by "PuTTY", your script file (Open_Putty.txt) is not opening PuTTY nor Plink. It's executing remote commands. So you should better name it export.txt or similar.

How to execute .bat file without opening console window using wix custiom action

Am executing .bat file in custom action using wix. When i run the set up it successfully exceuting .bat file but with console window. I don't want any console window. It is possibe to hide window using wix or with .bat file.
Thanks in Advance
You can do:
start program args
exit
but this will open command line window for just a moment, until the program starts, afterwhich it closes. Alternatively, and equivalently, you can do:
Start "" "program args"
So, to start notepad and then exit the cmd terminal, you'd do:
start notepad
exit
or:
Start "" "notepad"

Run interactive batch in Visual Studio post build events

I have a program written in vb.net. After I build, I want to launch an interactive batch file that executes a psexec command remotely. How can I do that?
this is my post build event:
call "$(ProjectDir)ExecOnGw.bat"
And this is my batch that if it runs in a normal command prompt, execution is ok.
c:\Sysinternal\psexec.exe \\gateway "C:\Remotepath\mybatch.bat" -u mydomain\myuser -p ******
pause
This batch calls another batch on a remote machine that does something, then if I want to exit, I have to press a "q" and "Enter". In a normal command prompt, it works fine. But in a Visual Studio post build event it goes down.
Help me!
I've done this before using the start command. I created a simple pause.bat file to demonstrate:
#echo off
pause Press Any Key
exit
If I put this in the post build event, I see a console that just closes.
call pause.bat
If I use this instead, I get a second console window that takes my input before closing.
start "My Process" /D c:\batch /WAIT pause.bat
Here is info about our technical development environment :
Microsoft Visual Studio Enterprise 2019
.NET Core 3.1
Just to add to #dsway good answer, I used Visual Studio 2019’s macros so that I could keep the directory path as relative:
start "My Process" /D "$(SolutionDir)Scripts" /WAIT blahblah.bat
Right-click on the Project in question
A context menu will show up
Select the Properties option
Select “Build Events”
Click on “Edit Post-build…”
Enter the aforementioned command that I posted above, and tailor it to your needs before pressing OK.