Skip to content

Commit 898628f

Browse files
Merge pull request #168 from kahanikaar/dev_kahanikaar
Launching Other Programs from Python
2 parents 2273ff4 + 4a1acf2 commit 898628f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Launching other Programs/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Folder contains Python Script to launch any other program in Windows Operating System.
2+
3+
```
4+
In command prompt run the python script
5+
C:\>python main.py
6+
Enter path of your program: C:\Windows\System32\calc.exe
7+
Calculator is launched
8+
```
9+
For similar cases
10+
```
11+
In command prompt run the python code to launch notepad
12+
C:\> python main,py
13+
Enter path of your program: C:\Windows\System32\notepad.exe
14+
Notepad is launched
15+
```

Launching other Programs/main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#Python script to launch anyother program
2+
import os
3+
import subprocess
4+
5+
program=input("Enter path of your program: ")
6+
7+
try:
8+
subprocess.Popen(program)
9+
except:
10+
print("Error opening program!")

0 commit comments

Comments
 (0)