| | |
opening an exe from Program Files directory in windows
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
I've just done a bit of digging around on python.org and found this:
http://bugs.python.org/issue1524
Looks like I'm not the first person to come up with this workaround....See the post made by daniel.weyh on the 25th June 2008.
Jas.
http://bugs.python.org/issue1524
Looks like I'm not the first person to come up with this workaround....See the post made by daniel.weyh on the 25th June 2008.
Jas.
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Those who understand binary .....
And those who don't!
This problem has been around for a long time and not just with Python:
python Syntax (Toggle Plain Text)
# the "Microsoft kludge", quoting a string within a string fixes the # space-in-folder-name problem, tells the OS to use the whole string # including spaces as a single command # (make sure filename does not contain any spaces!) os.system('"C:/Program Files/IrfanView/i_view32.exe" ' + filename)
drink her pretty
•
•
•
•
python Syntax (Toggle Plain Text)
os.system('"C:/Program Files/IrfanView/i_view32.exe" ' + filename)
Hang on....Looking back at my failed scripts from when I was playing around, I had the " and the ' the wrong way around! Damn these fat drummer fingers! grrr! heh heh!

Thanks for that Ene! Yes that's far better than my solution!
Cheers for now,
Jas.
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Those who understand binary .....
And those who don't!
•
•
•
•
just thinking... wouldnt it have made more sense to just change "Program files" to "Program_files" or something similar?
Simply renaming the 'Program Files' folder to 'Program_Files' would cause most (if not all) of your programs to either malfunction, or not work at all when you tried to run them.
The OS probably wouldn't take it too well either!
Plus any shortcuts you have for any programs in the 'Program Files' folder will also stop working...(e.g. desktop shortcuts and start menu links)
So in this case...No! Changing the folder name would definitely not be the best option. Ene's line of code is by far the best solution to the problem!
Cheers for now,
Jas.
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Those who understand binary .....
And those who don't!
•
•
Join Date: Sep 2009
Posts: 108
Reputation:
Solved Threads: 12
Its actually not as tough as people are making it out to be, if you have a space you need to put ' ' or " " around it to clarify that it has a space, maybe try this:
I may be wrong, i might have just been using Linux too long
Python Syntax (Toggle Plain Text)
import os os.system("'C:\Winamp\Winamp.exe'")
I may be wrong, i might have just been using Linux too long
![]() |
Similar Threads
- Rundll.exe error, Not respodning when closing windows XP (Viruses, Spyware and other Nasties)
- Cannot find Windows Explorer (Windows NT / 2000 / XP)
- winupdate.exe problem (Viruses, Spyware and other Nasties)
- RunTime error C++ C: \Program Files|MusicmatchJukebox\mm_tray exe (Viruses, Spyware and other Nasties)
- Internet Explorer & Windows Explorer (desktop shortcuts) Won't Load! (Viruses, Spyware and other Nasties)
- I have this c:\windows\system32\z14.exe HELP!!!!!! (Viruses, Spyware and other Nasties)
- Error loading C:\WINNT\Downloaded Program Files\bridge.dll (Viruses, Spyware and other Nasties)
- Error loading C:\WINDOWS\Downloaded Program Files\bridge.dll (Viruses, Spyware and other Nasties)
- rundll error loading C:\PROGRA~1\INTERN~3\inetkw.dll (Viruses, Spyware and other Nasties)
- "WINDOWS\ SYSTEM\ BRIDGE.DLL" (Viruses, Spyware and other Nasties)
Other Threads in the Python Forum
- Previous Thread: Text Files
- Next Thread: Cookies
| Thread Tools | Search this Thread |
abrupt ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog data decimals dictionaries dictionary drive dynamic error examples excel exe file float format function gnu graphics gui heads homework http ideas import input java launcher leftmouse line linux list lists logging loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyqt python random recursion schedule screensaverloopinactive script scrolledtext sqlite statistics stdout string strings sudokusolver sum table terminal text thread threading time tkinter tlapse tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable wikipedia windows write wxpython xlib







