Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python:': 0.05; 'python?': 0.05; 'subject:Python': 0.06; 'python': 0.08; '>>>>': 0.09; 'command-line': 0.09; 'from:addr:timgolden.me.uk': 0.09; 'from:name:tim golden': 0.09; 'message-id:@timgolden.me.uk': 0.09; 'subject:2.7': 0.09; 'subject:files': 0.09; 'wrote:': 0.15; '(sorry': 0.16; 'bits:': 0.16; 'claveau': 0.16; 'executables': 0.16; 'python.exe': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'shell=true)': 0.16; 'cc:addr:python-list': 0.16; 'subject:lost': 0.19; 'subject:Windows': 0.19; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'right,': 0.28; 'import': 0.29; 'anyway.': 0.29; 'problem': 0.29; 'cc:addr:python.org': 0.30; 'commands,': 0.30; 'tjg': 0.30; 'does': 0.33; 'header:User- Agent:1': 0.34; 'certain': 0.36; 'options': 0.36; 'file': 0.36; 'skip:" 10': 0.36; 'but': 0.37; 'received:192': 0.38; 'subject:: ': 0.38; 'two': 0.38; 'run': 0.39; 'got': 0.39; 'hope': 0.60; 'from:addr:mail': 0.64; 'therefore,': 0.66; 'subject: (': 0.84; '==>': 0.91; 'or:': 0.91; 'to:none': 0.93 Date: Thu, 23 Jun 2011 08:31:26 +0100 From: Tim Golden User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 CC: python-list@python.org Subject: Re: Python 2.7 and cmd on Windows 7 64 (files lost) References: <4e02de32$0$30749$ba4acef3@reader.news.orange.fr> In-Reply-To: <4e02de32$0$30749$ba4acef3@reader.news.orange.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308814290 news.xs4all.nl 14140 [::ffff:82.94.164.166]:60515 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8279 On 23/06/2011 07:33, Michel Claveau - MVP wrote: > Hi! > > (sorry for my bad english...) > > On Win 7 64 bits: > Command-Line > CD \Python27 > dir C:\Windows\System32\SoundRecorder.exe :==> OK > Python.exe > >>>> import os >>>> os.system("dir C:\\Windows\\System32\\SoundRecorder.exe") > > ==> Do not found the file !!! > > and os.system("cmd /k") then "dir C:\Windows\System32\SoundRecorder.exe" do not found > anyway. > > But: > {Ctrl-Z} in Python > then dir C:\Windows\System32\SoundRecorder.exe run OK > > Therefore, is the problem only in Python? Certain commands, including "dir" and "copy" are not executables in their own right, but merely subcommands of cmd.exe. You've got two options in Python: os.system (r"cmd /c dir c:\windows") or: subprocess.call (["dir", "c:\\windows"], shell=True) which basically does it for you behind the scenes. I hope that helps.. TJG