| | |
opening an exe from Program Files directory in windows
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: 100
Reputation:
Solved Threads: 11
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 |
address anydbm app bash beginner bits changecolor cipher clear conversion coordinates corners cturtle curves definedlines development dictionary dynamic events examples excel external feet file float format function generator getvalue gui handling homework iframe images import input ip java keycontrol line linux list lists loan loop maintain matching maze millimeter mouse number numbers output parsing path port prime programming projects py2exe pygame pymailer python queue random rational raw_input recursion recursive scrolledtext searchingfile singleton slicenotation split string strings tails terminal text threading time tlapse tooltip tuple tutorial type ubuntu unicode url urllib urllib2 valueerror variable variables vigenere web whileloop word wxpython xlwt







