Okay, the problem seems to be the fact that you're calling shutdown.exe from a 32 bit process (I presume you're using the more popular 32 bit version of python, rather than the native 64 bit one).
Under 64bit windows, any call to a system32/* executable from a 32-bit process is silently redirected to syswow64\*, which contains 32 bit versions of (almost) all the executables. So when you call system32\shutdown.exe from your python process, Windows tries to call syswow64\shutdown.exe. Problem is, there is *no* 32bit version of shutdown available (syswow64\shutdown.exe doesn't exist), so your call ends up failing. tl;dr version - You can't call shutdown.exe on a 64 bit machine from 32 bit python Solutions: 1. Use the native 64 bit version of python 2. http://blogs.sepago.de/nicholas/2008/03/13/jailed-32-bit-processes-on-windows-x64/ On Tue, Dec 29, 2009 at 11:53 PM, ™aßlเίlαslเ ► <abhilash.p...@gmail.com>wrote: > Ya... I tried the full path and all... its not working... > where as I can able to execute the other commands like 'ping' , > 'md' but not 'shutdown' > > > > On Tue, Dec 29, 2009 at 11:37 PM, Pradeep Gowda <prad...@btbytes.com> > wrote: > > > On Tue, Dec 29, 2009 at 12:58 PM, ™aßlเίlαslเ ► <abhilash.p...@gmail.com > > > > wrote: > > > Hi, > > > Yes 'shutdown' command is working absolutely fine from the command > > line > > > at Windows 64 bit, > > > but I have find something interesting is that : > > > > > > > > > import os > > > os.system("cmd") > > > > > > After running above code at python, then from that command window, I > try > > to > > > run the 'shutdown ' command, > > > and its giving the error . I tried to search the "shutdown.exe" file at > > > C:\WINDOWS\system32 from the same > > > command window, and it can't locate it, where as I can find it by > windows > > > command line. > > > > > > > > > > > > > > > On Tue, Dec 29, 2009 at 8:24 PM, Pradeep Gowda <prad...@btbytes.com> > > wrote: > > > > > >> On Tue, Dec 29, 2009 at 9:22 AM, ™aßlเίlαslเ ► < > abhilash.p...@gmail.com > > > > > >> wrote: > > >> > > >> > *import os > > >> > os.system("shutdown /?")* > > >> > > > >> > *its saying "shutdown is not an internal or external command or > > >> executable > > >> > batch file"* > > >> > > >> Is shutdown a valid command in the new OS? > > >> Atleast it looks like that from the error message. > > >> > > >> Try running `shutdown` from the command line and see whether you get > > >> the same error. > > > > try with the full path > > assuming shutdown.exe is in c:\windows\system32 > > > > os.system("c:\\windows\\system32\\shutdown.exe") > > > > might work. > > > > Or is it c:\windows\system64 ?? > > I do not have a windows PC to verify this. > > > > My hunch is that python's sys.path does not include the windows system > > directories. > > > > +PG > > _______________________________________________ > > BangPypers mailing list > > BangPypers@python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > ™aßlเίlαslเ ► > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Yuvi Panda T http://yuvi.in/blog _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers