Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute program or batch file? [duplicate]

I have installed PyCharm to using Python language on Windows 10.

I'm trying to execute command from Linux command in PyCharm, I used this code:

import subprocess
subprocess.run("cat",shell=True,text=True)

But I get this error:

'cat' is not recognized as an internal or external command, operable program or batch file.

I want to execute several commands another such as this example, but all commands raise the same error. How to solve this?

like image 664
Abdallah_98 Avatar asked Jan 15 '21 01:01

Abdallah_98


People also ask

How do you repeat a batch file?

Pressing "y" would use the goto command and go back to start and rerun the batch file. Pressing any other key would exit the batch file.

How do you execute a batch file?

To run a batch file, move to the directory containing the file and type the name of the batch file. For example, if the batch file is named "hope. bat," you'd type "hope" to execute the batch file.

How do you make a duplicate of a file?

Go to the location of the document you want to duplicate. Right-click the file, and click Open as copy. A new file opens and is named Copy of Document, Document 2, or similar. In the new file that opens, click the File tab, then click Save As.

How to start an EXE file from a batch file?

To start an exe file from a batch file in Windows, you can use the start command. For example, the following command would start Notepad in most versions of Windows. START C:WindowsNOTEPAD.EXE. The start command can be used for other exe files by replacing the file path with the path to the exe file. If you want to start multiple executable ...

How to run a program from a batch file in Visual Studio?

Use the start command to prevent the batch file from waiting for the program. Just remember to put a empty double quote in front of the program you want to run after "Start". For example, if you want to run Visual Studio 2012 from a batch command: notice the double quote after start. Show activity on this post. You can use the exit keyword.

Can you run a batch file in Command Prompt Windows 10?

However, running batch files in Command Prompt is still relevant to execute commands to change settings, automate routines, and start apps or launch websites on your device. In this Windows 10 guide, we will walk you through the steps to create and run a batch file.

How do I run an EXE Program in Windows?

To create a batch file to run some .exe program in Windows, open a text editor (e.g. Notepad) and enter a command as follows: start "C:\Path\Program.exe" If you need to run a program with some additional parameters, you should also specify a "WindowName" just after the start command:


Video Answer


1 Answers

Cat is a binary included in Unix systems, since windows isn't based on Unix, it wouldn't work. You should rather try the TYPE command in Windows

like image 128
mTvare Avatar answered Oct 17 '22 09:10

mTvare