+ 1

why cant i run this program ?

import os os.system("notepad.exe") ------------------------------------------------------- 'Notepad' is not recognized as an internal or external command, operable program or batch file.

26th Oct 2024, 12:20 PM
ali
10 ответов
+ 1
I made a test on Windows, and it is working. notepad.exe is located in the Windows folder, so first, you better check if notepad.exe is existing in your Windows folder. If it exists, which it normally does, then you could try enter the full path in the Python script like... "C:\\Windows\\notepad.exe"
26th Oct 2024, 5:02 PM
Jan
Jan - avatar
+ 6
ali , on an up-to-date windows environment there are some restrictions (by default) to run code like this (executing applications) in vscode. ensure you have permission to run applications like notepad, as some environments restrict program execution. you could modity the settings for this behaviour, but it is not recommended since harmful `exe` files could create security issues.
26th Oct 2024, 3:53 PM
Lothar
Lothar - avatar
+ 2
You are trying to run NOTEPAD.EXE. The error message is telling you this is not a valid command. Are you running this python script on your Windows PC? If not, then that's the problem. Notepad.exe does not exist on a Mac, on a phone, or in the SoloLearn Code editor. It only exists in Microsoft Windows.
26th Oct 2024, 1:53 PM
Jerry Hobby
Jerry Hobby - avatar
+ 2
If you are running this script on Windows, it should work. The only reason I can think of that it does not work is if Notepad is not in your path. But notepad should be in your path, so that's interesting. If you go to a CMD shell prompt, type NOTEPAD, does that work? Can you try to run other commands? The key issue here is the error message. It is saying notepad is not found. I've tested your code on my machine and it works fine. Try this: import os os.system("echo 'Hello World!'") You should see "Hello World!" in your console.
26th Oct 2024, 3:29 PM
Jerry Hobby
Jerry Hobby - avatar
+ 1
its on windows
26th Oct 2024, 1:59 PM
ali
+ 1
thankyou guys it worked well
27th Oct 2024, 12:43 AM
ali
+ 1
The error message indicates that your operating system cannot locate notepad.exe. This could be due to a few reasons: 1. Operating System: You might not be using Windows. notepad.exe is specific to Windows, so this command won’t work on other operating systems like Linux or macOS. 2. Environment Path: If you're on Windows, the system might not have notepad.exe in its environment path. Usually, notepad.exe is located in C:\Windows\System32, which should be in the Windows PATH by default. To troubleshoot: 1. Verify OS: Make sure you're on a Windows operating system. 2. Specify Full Path: Try using the full path to notepad.exe: import os os.system("C:\\Windows\\System32\\notepad.exe") 3. Check Path Variable: Ensure C:\Windows\System32 is in your system’s PATH environment variable.
28th Oct 2024, 11:43 AM
Naeem Ali Saleh Hassan Hamlah
Naeem Ali Saleh Hassan Hamlah - avatar
0
Hi
27th Oct 2024, 7:06 AM
Raqeeb Rahman
Raqeeb Rahman - avatar
0
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <div class="credit">Copyright<sup>&copy;</sup>-Gulshan Mahawar</div> <img src="https://i.imgur.com/jcAdhIu.jpeg" id="back"> <!--<img src="https://i.imgur.com/EQLsL5s.png" id="heading">--> <div id="loader"> <div class="c1 circle"></div> <div class="c2 circle"></div> <div class="c3 circle"></div> </div> <div id="option"> <div id="opt_heading"><div class="text">Level:</div></div> <div id="easy" class="opt"><div class="text">Easy</div></div><br><br> <div id="medium" class="opt"><div class="text">Medium</div></div><br><br> <div id="hard" class="opt"><div class="text">Hard</div></div> </div> <div id="container"></div> <div id="start">Start</div> <div id="exit">Exit</div> </body> </html>
28th Oct 2024, 11:52 AM
هكر الخلود
هكر الخلود - avatar
0
Naeem Ali Saleh Hassan Hamlah Are notepad.exe also presented in two folders on your Windows version, or is only presented in system32 on your Windows version? I have the .exe-file in both folders.
28th Oct 2024, 12:38 PM
Jan
Jan - avatar