Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cannot execute Windows commands via Python in 64-bit


  • From: nsjmetzger at gmail.com (nsjmetzger at gmail.com)
  • Subject: Cannot execute Windows commands via Python in 64-bit
  • Date: 2 May 2007 14:57:40 -0700

I have a script that runs fine in Windows 2003 (32-bit). It basically
calls the Windows defrag command. When I try the exact same code on
Windows 2003 (64-bit) I get the following message:

 C:\Scripts>autodefrag.py
Starting defragment:  defrag -v C: >>c:/Scripts/DEFRAG20070502.log
'defrag' is not recognized as an internal or external command,
operable program or batch file.

I have tried defrag.exe and even giving it the full path to
defrag.exe. Always the same result. Here is the python code that is
generating this error:

cmd = "defrag -v C: >>c:/Scripts/DEFRAG20070502.log"
print "Starting defragment: ", cmd
errorlevel = os.system(cmd)


Anyone know what the heck is going on and how to fix it? This code
works fine on my 32-bit windows machines.
Thanks.