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>auto defrag.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. 6 3798 ns********@gmai l.com wrote:
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>auto defrag.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.
Sounds like system can't find defrag. Usually this is because of a path
issue. Are you running the script in the foreground or scheduled? Can
you open a command prompt and enter the command and have it work? If
you give full path, this shouldn't be the problem.
-Larry
On May 2, 3:07 pm, Larry Bates <larry.ba...@we bsafe.comwrote:
nsjmetz...@gmai l.com wrote:
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>auto defrag.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.
Sounds like system can't find defrag. Usually this is because of a path
issue. Are you running the script in the foreground or scheduled? Can
you open a command prompt and enter the command and have it work? If
you give full path, this shouldn't be the problem.
-Larry
I have tried foreground and scheduled (neither works). I can run
defrag from the command prompt with no problem. If I give it the full
path in the script it still fails. I am completely befuddled. Help.
minitotoro wrote:
On May 2, 3:07 pm, Larry Bates <larry.ba...@we bsafe.comwrote:
>nsjmetz...@gma il.com wrote:
>>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>auto defrag.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.
Sounds like system can't find defrag. Usually this is because of a path issue. Are you running the script in the foreground or scheduled? Can you open a command prompt and enter the command and have it work? If you give full path, this shouldn't be the problem.
-Larry
I have tried foreground and scheduled (neither works). I can run
defrag from the command prompt with no problem. If I give it the full
path in the script it still fails. I am completely befuddled. Help.
Copy and paste the traceback here for us.
-Larry
On May 2, 3:46 pm, Larry Bates <larry.ba...@we bsafe.comwrote:
minitotoro wrote:
On May 2, 3:07 pm, Larry Bates <larry.ba...@we bsafe.comwrote:
nsjmetz...@gmai l.com wrote: 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>auto defrag.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.
Sounds like system can't find defrag. Usually this is because of a path
issue. Are you running the script in the foreground or scheduled? Can
you open a command prompt and enter the command and have it work? If
you give full path, this shouldn't be the problem.
-Larry
I have tried foreground and scheduled (neither works). I can run
defrag from the command prompt with no problem. If I give it the full
path in the script it still fails. I am completely befuddled. Help.
Copy and paste the traceback here for us.
-Larry
I'm sorry, but I'm not familiar with traceback. How do I use it?
Thanks.
On May 2, 4:15 pm, minitotoro <nsjmetz...@gma il.comwrote:
On May 2, 3:46 pm, Larry Bates <larry.ba...@we bsafe.comwrote:
minitotoro wrote:
On May 2, 3:07 pm, Larry Bates <larry.ba...@we bsafe.comwrote:
>nsjmetz...@gma il.com wrote:
>>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>auto defrag.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.
>Sounds like system can't find defrag. Usually this is because of a path
>issue. Are you running the script in the foreground or scheduled? Can
>you open a command prompt and enter the command and have it work? If
>you give full path, this shouldn't be the problem.
>-Larry
I have tried foreground and scheduled (neither works). I can run
defrag from the command prompt with no problem. If I give it the full
path in the script it still fails. I am completely befuddled. Help.
Copy and paste the traceback here for us.
-Larry
I'm sorry, but I'm not familiar with traceback. How do I use it?
Thanks.
Upon further investigation it turned out to be a windohs 64-bit issue
(which is what I was afraid of). I did however find an asinine work
around.
Make a copy of defrag.exe from the system32 folder and paste it in the
same directory as the python script. Voila! It now works. Piece of
junk windohs... :-S
minitotoro <ns********@gma il.comwrote:
> Upon further investigation it turned out to be a windohs 64-bit issue (which is what I was afraid of). I did however find an asinine work around.
Make a copy of defrag.exe from the system32 folder and paste it in the same directory as the python script. Voila! It now works. Piece of junk windohs... :-S
If you are using a 32-bit Python, then all references you make to
\windows\system 32 are automatically rewritten to \windows\syswow 64. If
defrag.exe is not present in \windows\syswow 64, that could explain it.
Unbelievable but true. Although we were all smart enough to handle the
transition from \windows\system in Win16 to \windows\system 32 in Win32,
Microsoft apparently believes programmers have all grown too stupid to
handle the transition to Win64 on our own.
Some registry references are also silently rewritten.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Moosebumps |
last post by:
So, after reading some messages about os.system, and looking at the popen
stuff and trying it a bit, I still have not found a way to keep a command
window open for several commands (on Windows 2000/XP), while seeing the
normal output in a command window. All I want to do is do what a batch file
does, but I want to actually have functions and associative arrays and all
the other niceties of python.
What's the deal with that? I thought...
|
by: mike |
last post by:
regards:
I use Jtidy (api) to translate a HTML file into a "XHTML file".
But The "XHTML file" cannot be identified by nokia 6600.
Do I miss something important?
Or this is Jtidy's weakness or bug?
Can someone excellent to tell me the reason.
best wishes
|
by: Chris |
last post by:
I posted this in the C# language group, then thought it
might be more appropriate in this group. I would not
cross-post except I want the answer so badly.
I built small C# Web and Web Service applications in a
training class last week. The applications worked in the
class, but when I tried to run them again over the
weekend, they both bombed. Instead of getting my Web
page, or the Web Service page, I get a page full of error
text...
|
by: freesteel |
last post by:
I have posted about this problem before. SInce then I found a much
better article to help with embedding python in a multithreaded
application:
http://www.linuxjournal.com/article/3641
I found this article very good and it clarified for me what needs
doing. Now I have an example application that almost works, but it is
far from reliable. If I run this several times I get crashes telling me
that the heap is modified after deallocation....
|
by: miago |
last post by:
Searching this forum I found an example of running Unix commands from Python;I wonder if there is a way to get the output of windows commands on a string using Python.Thanks in advance;
Miago.
| |
by: techtonik |
last post by:
Hello, everyb.
Does anybody know simple cross-platform method of probing if
executable binary is available and launching it.
Problem no.1: test if executable file is available
I'll take windows platform as the most relevant in this case.
os.access() doesn't handle env PATHEXT and can't detect if a given
path would be executable or not. Here "executable" means file that
|
by: tmp123 |
last post by:
Hello,
Thanks for your time.
We have very big files with python commands (more or less, 500000
commands each file).
It is possible to execute them command by command, like if the
commands was typed one after the other in a interactive session?
|
by: raocheng |
last post by:
Please see the following code.
Suppose I have many shell commands to be executed. And I don't want to
fork a sub shell for each command(eg: status,output =
commands.getstatusoutput(cmd)) because it is too expensive. I want to
use only one sub shell to execute all these commands and want to get
each command's output. How can I accomplish this task ? Thanks in
advance.
===========================================
#!/usr/bin/env python
|
by: Hishaam |
last post by:
How to execute commands in internal zones of solaris using python
running from the global zone ?
i tried --
1os.popen("zlogin <zone1>")
2os.popen("zonename")
the 2nd command executes back into the global zone and not into the
internal zone
can anyone help?
|
by: rcook349 |
last post by:
I'm trying to automate our builds and publishes of our Windows application
(deployed to a website via ClickOnce).
I'm getting close, I think, on the commands I need to execute. However, how
do I put these commands in some sort of executable file?
I thought at first a VBScript file (Windows script), but from what I'm
reading that is old techology.
A script in PowerShell? Not too familiar with this?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |