How to make an exe in cmd from a .py not close the window when it ends? [closed] - cmd

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 27 days ago.
Improve this question
I'm traying to make an app, its too many lines to output here a simple version. I don't know if there is something wrong with the dll's or the .py, with auto-py-to-exe I made it an executable,& it gave some errors (torch libreries not found), but when running the program (exe), it doesn't seem to have any problem (it runds as the py program in the terminal).
So, does the terminal closes by its own when the script is finished? if so; how can I make the program not close till I press a key or force the close?
If the terminal doesn't close by it's own, could those dll be the problem?
Please let me know if the terminal closes by its own (the script is very slow and it takes 45 min for me to see if it works or not).
Thanks.
I've uninstalled and installed torch and torchvision modules (but there's always an errors with some libreries)

The solution I'm going to use is:
import os
......
os.system("pause")

Python has a builtin function input that allows you to customize the prompt that the user will get:
input("Press enter to exit.")
This will show the prompt Press enter to exit.

Related

Basic terminal question --> how to execute commands

I have a very silly question about the terminal. I am following a React tutorial and I am trying to set up a few things in the vscode terminal. Below you can find a screenshot of my terminal. I would like to run some more things, however, my name is not displaying and I don't know how to get it back. In other words, which command do I use to get back 'Name-air:~name$'?
Even though this is quite a noob question, an answer would really help me out:). thanks in advance!
https://carldesouza.com/how-to-stop-a-react-app-from-running-in-windows/
you can simply enter ctrl+C and it will prompt you with terminate job y/n type y and it will terminate the program

Is there a Windows command to close a file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have opened a file through on Windows command prompt, just by navigating to that directory and then typing it's name. Now is there a way to close that (open) file through the command prompt? I've been searching around and I can't find out how. Seems to be a pretty simple command to not exist.
There is no MS-DOS in Windows and has not been since about 2003. The "Command Prompt" program (named cmd.exe) runs in a console window and looks and behaves like the command interpreter of MS-DOS, enough like it to seem the same to many people, although there are some small differences.
If you give a filename as a command to a command prompt and that named file is not a program, it looks at the extension to try to select an appropriate program to run and open the file. The .doc extension usually corresponds to MS Word (Office) or the stripped-down version MS Works, but depending on what software you have installed and how it is configured .doc could be something else. You can find out what it is on your system by the command-prompt commands assoc .doc and usually then ftype (value from assoc) or by looking in the registry under HKEY_CLASSES_ROOT. Once the program runs (a running program is also called a process) it may keep the file open while running (like Word) or only open it briefly and then close it (like notepad).
Once you know what program/process is running, you can direct that process to stop with the taskkill command. Type taskkill /? for help information. If there is more than one process running the same program and you use the /im option, it will stop all of them, not just the one you want. To use the /pid option, tasklist or TaskManager can help you find the right process -- but if you use TaskManager it can also stop the process, so taskkill is unnecessary. If the program malfunctions and doesn't stop when directed, taskkill /f will force it, but this may leave the open file(s) with damaged and incorrect or unusable data.
Also note that command itself effectively keeps the directory open. If you are trying to rename or move a subtree of files including that directory, you must first either cd the command process somewhere else, or terminate it with exit.

Livecode standalone program takes 30 seconds to load

I've run into an issue with a program I created using Livecode, and now I'm looking for some help from the experts. My Google-fu is strong, yet the answer eludes me...
So here's the deal. I made a very basic note-taking program for Windows only, using very noob skills. I've been using it daily for work for the past month at least. It functions exactly as it should, except for these few things that don't make sense:
When loading the program, it takes 25-30 seconds to load. Not convenient considering it's pretty basic; one button and 5-6 text input fields, with the same number of label fields. And one background. The button just clears the text input fields.
I started to notice a problem when I went to create a batch file to load all my work programs. When the program is loaded thru Command Prompt, if I close CMD it will close the program too. I tried the same using Powershell, and it still closes as soon as the Powershell window closes. Really really strange.
I managed to find another standalone program made with Livecode, downloaded it and tested the CMD command to see if the same thing happened. It didn't, that program loaded instantly and it is ENORMOUS. It also didn't close when I closed the CMD window. I even tried this: opened my program and the downloaded program using the same CMD session, and when I closed CMD, my program closed but the downloaded one did not.
Then, I downloaded the source code for the program that was working correctly. I created a standalone for it, and tried to open that. It acts the same way as my note program does.
I don't get it. It's got to be something in my Standalone Application Settings considering what happened in the last step I mentioned, and I've been over and over those settings for hours, but I just don't have the knowledge of LC to know what to look for. I've scoured the web looking for answers to this, but it seems to be just me having this issue (story of my life, lol).
I'll be happy to post any codes, scripts, or files needed, please let me know. I just don't know which things to post =P
Any suggestions are very much appreciated!! Thank you. =)
If you call the program from the prompt directly, e.g. using
C:\program files (x86)\your_standalone.exe
the app is treated as a command line app. I have also noticed that a LiveCode app can sometimes close if the invoking command line prompt is closed, while it may sometimes continue to run. Perhaps the handling of the relaunch message has to do with it, since this message basically handles commands from the command line.
If you want the command line process to finish independently from the invoked LiveCode application, you can use the start command:
start "" "C:\program files (x86)\your_standalone.exe"
don't have enough info to be able to tell what your issue is. But that much of a delay is not usual for LiveCode apps so something is definitely wrong. How long does your app take to load if you open the stackfile in the IDE?
Not sure what StackOverflow allows but if you could upload your scripts and if possible stackfile that will give us more to go on
This has nothing to do with Windows, Batchfiles, or CMD.
CMD can workaround your problem, if it's a GUI program. See Start command, and read the help as it explains the starting behaviour of CMD and CMD's Start.
Explorer has different rules. Anything else that starts programs call CreateProcessExW which has it's own rules.

How to Open Terminal Window Automatically on Mac OS X [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
On my Mac, there is no window open when I start Terminal app. I just played with a friend's Mac, a window is automatically opened on startup of terminal. He doesn't know how it's done. I just played with preferences and couldn't find anything for that. Does anyone know how to do that?
I'm just grasping at straws here: is it possible that your Terminal program is always running in the background, and you are not actually completely exiting? You can perform this test: Run Terminal in whatever manner you usually do, and then press Command-Q to quit the application completely. Now run Terminal again. Did it open a new window?
The Mac has a slightly different paradigm on open/closed applications, namely that closing the last window doesn't actually quit the application. Combine this with the fact that Mac users rarely ever actually reboot their computers, and it's easy for relatively novice Mac users to have many applications that are simply running in the background that are never closed completely.
Just a shot in the dark. If you are for sure exiting the app completely than I can't think of a solution for the problem either.
Create a Windows Group
Go to Preferences -> Start, and select the windows group to open on start up
From the Terminal App, choose Preferences: select Startup and verify that the "On startup, open new window with settings:" radio button is selected and select Basic from the pull-down menu. That's all I have and it starts up with an open window for me.
If you've tried all the above suggestions, see if anything weird is appearing in your console. Open up /Applications/Utilities/Console.app and watch the "All Messages" log while you open Terminal.
You could try one of the other terminal apps that are out there for Mac. I prefer iTerm, it's free and works very well. It also gives you nice features like tabs, color schemes and fullscreen terminals.
You can also try this out, it is a Ruby gem that lets you automate opening mutliple tabs that run preset scripts or commands: https://github.com/Achillefs/elscripto

Overcoming "It is being used by another person or program." [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is there a way to unlock Windows files without downloading a utility?
I have a few files on my Windows XP C: drive that are very old and very useless. When I try to delete these files I get the following message:
Cannot delete FILENAME.zip: It is being used by another person or program
Close any programs that might be using the file and try again.
No one is accessing this file. No program is using it currently. Windows has screwed up the file locking mechanism.
Is there a way to delete this file without downloading someone's unlocking utility? I find the sites offering these programs to be a tad sketchy.
How could you force the file to unlock from within a program? I'm competent in Java, Perl, and Ruby, but I haven't seen anything among their libraries that would aid me here.
I've successfully used Process Explorer to find out which process has the file open. It saves a reboot that may not fix the problem anyway.
In process explorer: Find > Handle or DLL... then search for the name of the folder/file, then double click one of the search results. It'll select a handle in the main window, which you can right click and close.
Try downloading "Unlocker". Google it and take my words that it doesn't have any worm/spyware/virus. It is pretty cool utility and works great. Give it a try.
Did you try the commandline command OpenFiles
It is built in (XP and above I believe) and has several arguments that can be passed in.
Use msconfig and start up with everything turned off.
Then try to move / delete the file.
Or you can always boot up in safe mode and delete it.
You do that by hitting f8 when the machine boots up.
If you reboot and the files are still locked, then there is some process on your machine that is still using them. First you should figure out what that process is and determine if the files really aren't used any more or not.
Rebooting to Safe Mode is often a very easy way to do it. When you boot in safe mode, it won't load all the stuff set to run on startup. Press F8 while it's booting to access the boot menu, and choose "safe mode".
I had a .jpg pfile that hasd that issue and I couldn't delete. That brought me to this thread. When nothing else worked I renamed the file and left off the .jpg. THEN I could delete it easily. Not sure why, but worked for me
You don't need any utility.
Just use Win32 api to unlock them (simply close the handle)

Resources