473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

'rar' is not recognized as an internal or external command£¿£¿£¿£¿


'rar' is not recognized as an internal or external command,
operable program or batch file.
import os
import time
source = [r'e:\temp\code',r'e:\temp\domains']
target_dir = r'e:\temp\bak'
target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar'
rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source))
print rar_cmd
if os.system(r'cd D:\Program Files\WinRAR') == 0:
if os.system(rar_cmd) == 0:
print 'Successful backup to',target
else:
print 'Backup Failed!'
else:
print 'FAILED!!!'

'rar' is not recognized as an internal or external command,
operable program or batch file.

rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains
Backup Failed!
but.........................

D:\>cd D:\Program Files\WinRAR

D:\Program Files\WinRAR>rar a -idcdp e:\temp\bak20060222191139.rar
e:\temp\code
e:\temp\domains

Creating archive e:\temp\bak20060222191139.rar

Adding e:\temp\Code\Code\.classpath OK
Adding e:\temp\Code\Code\.project OK
Adding e:\temp\Code\Code\common\Code.class OK
Adding e:\temp\Code\Code\common\Code.java OK
Adding e:\temp\Code\Code\common OK
Adding e:\temp\Code\Code OK
Adding e:\temp\Code OK
Adding e:\temp\domains\examples.jar OK
Adding e:\temp\domains\medrec.jar OK
Adding e:\temp\domains\wls.jar OK
Adding e:\temp\domains\wlw.jar OK
Adding e:\temp\domains OK

D:\Program Files\WinRAR>

why?


--
Ê÷Éϲä»Ò
Feb 23 '06 #1
4 10483
Ê÷Éϲä»Ò wrote:
'rar' is not recognized as an internal or external command,
operable program or batch file.
import os
import time
source = [r'e:\temp\code',r'e:\temp\domains']
target_dir = r'e:\temp\bak'
target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar'
rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source))
print rar_cmd
if os.system(r'cd D:\Program Files\WinRAR') == 0:
if os.system(rar_cmd) == 0:
print 'Successful backup to',target
else:
print 'Backup Failed!'
else:
print 'FAILED!!!'

'rar' is not recognized as an internal or external command,
operable program or batch file.

rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains
Backup Failed! It is always a good idea to use full path file location specs like:
rar_cmd = r"D:\Program Files\WinRAR\rar.exe a -idcdp %s %s" % (target,'
'.join(source))
..
Have not tested it, but I suppose it will do the job.

Claudio

but.........................

D:\>cd D:\Program Files\WinRAR

D:\Program Files\WinRAR>rar a -idcdp e:\temp\bak20060222191139.rar
e:\temp\code
e:\temp\domains

Creating archive e:\temp\bak20060222191139.rar

Adding e:\temp\Code\Code\.classpath OK
Adding e:\temp\Code\Code\.project OK
Adding e:\temp\Code\Code\common\Code.class OK
Adding e:\temp\Code\Code\common\Code.java OK
Adding e:\temp\Code\Code\common OK
Adding e:\temp\Code\Code OK
Adding e:\temp\Code OK
Adding e:\temp\domains\examples.jar OK
Adding e:\temp\domains\medrec.jar OK
Adding e:\temp\domains\wls.jar OK
Adding e:\temp\domains\wlw.jar OK
Adding e:\temp\domains OK

D:\Program Files\WinRAR>

why?

Feb 23 '06 #2
Ê÷Éϲä»Ò said the following on 23.02.2006 10:03:
rar_cmd = r'"D:\Program Files\WinRAR\rar.exe" a -idcdp %s %s' % (target,' '.join(source))


You can't cd to d:\Program Files\WinRAR and then call rar

You have to call rar with full path.

from subprocess import *
retcode = call([r'"D:\Program Files\WinRAR\rar.exe"', 'a', '-idcdp', target,
' '.join(source)])
if retcode == 0:
print "everything OK"
--
Dejan Rodiger - PGP ID 0xAC8722DC
Delete wirus from e-mail address
Feb 23 '06 #3
thank everyone!!!

the code:

import os
import time
source = [r'e:\temp\code',r'e:\temp\domains']
target_dir = r'e:\temp\bak'
target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar'
rar_cmd = "D:\\Progra~1\\WinRAR\\rar.exe a -idcdp %s %s" % (target,'
'.join(source))
print rar_cmd
if os.system(rar_cmd) == 0:
print 'Successful backup to',target
else:
print 'Backup Failed!'

thanks again!
--
Ê÷Éϲä»Ò
"Ê÷Éϲä»Ò" <zh*********@hotmail.com> дÈëÓʼþ
news:dt**********@news.cn99.com...

'rar' is not recognized as an internal or external command,
operable program or batch file.
import os
import time
source = [r'e:\temp\code',r'e:\temp\domains']
target_dir = r'e:\temp\bak'
target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar'
rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source))
print rar_cmd
if os.system(r'cd D:\Program Files\WinRAR') == 0:
if os.system(rar_cmd) == 0:
print 'Successful backup to',target
else:
print 'Backup Failed!'
else:
print 'FAILED!!!'

'rar' is not recognized as an internal or external command,
operable program or batch file.

rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains
Backup Failed!
but.........................

D:\>cd D:\Program Files\WinRAR

D:\Program Files\WinRAR>rar a -idcdp e:\temp\bak20060222191139.rar
e:\temp\code
e:\temp\domains

Creating archive e:\temp\bak20060222191139.rar

Adding e:\temp\Code\Code\.classpath OK Adding e:\temp\Code\Code\.project OK Adding e:\temp\Code\Code\common\Code.class OK Adding e:\temp\Code\Code\common\Code.java OK Adding e:\temp\Code\Code\common OK Adding e:\temp\Code\Code OK Adding e:\temp\Code OK Adding e:\temp\domains\examples.jar OK Adding e:\temp\domains\medrec.jar OK Adding e:\temp\domains\wls.jar OK Adding e:\temp\domains\wlw.jar OK Adding e:\temp\domains OK
D:\Program Files\WinRAR>

why?


--
Ê÷Éϲä»Ò

Feb 24 '06 #4
os.chdir() ?
thank you!

--
????
"Dennis Lee Bieber" <wl*****@ix.netcom.com> ????
news:2n********************************@4ax.com...
On Fri, 24 Feb 2006 11:36:08 +0800, "Ê÷Éϲä»Ò" <zh*********@hotmail.com>
declaimed the following in comp.lang.python:
thank everyone!!!

I'd had to run to work so couldn't test, but... notice this:
C:\Documents and Settings\Dennis Lee Bieber>python
ActivePython 2.3.5 Build 236 (ActiveState Corp.) based on
Python 2.3.5 (#62, Feb 9 2005, 16:17:08) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
import os
os.system("dir /w") Volume in drive C is System
Volume Serial Number is 0487-A514

Directory of C:\Documents and Settings\Dennis Lee Bieber

[.] [..] [.eclipse]
[.gps] [.mysqlcc] [.netbeans]
[.refactorit] [.refactorit_please_delete_me]
[Application Data]
[Desktop] Eudora.lnk [Favorites]
[Start Menu] [workspace]
1 File(s) 820 bytes
13 Dir(s) 22,481,092,608 bytes free
0 os.system("cd e:\\userdata") 0 os.system("dir /w") Volume in drive C is System
Volume Serial Number is 0487-A514

Directory of C:\Documents and Settings\Dennis Lee Bieber

[.] [..] [.eclipse]
[.gps] [.mysqlcc] [.netbeans]
[.refactorit] [.refactorit_please_delete_me]
[Application Data]
[Desktop] Eudora.lnk [Favorites]
[Start Menu] [workspace]
1 File(s) 820 bytes
13 Dir(s) 22,481,092,608 bytes free
0 os.chdir("e:\\userdata")
os.system("dir /w") Volume in drive E is Data
Volume Serial Number is 2626-D991

Directory of e:\userdata

[.] [..] [Dennis Lee Bieber]
DummyQuicken.IDX
DummyQuicken.QDF DummyQuicken.QEL DummyQuicken.QPH [Root]
4 File(s) 316,184 bytes
4 Dir(s) 307,433,058,304 bytes free
0


Notice how using os.system() to do a "cd" doesn't "stick"... But if
you used os.chdir() instead, THAT setting carries over to subsequent
os.system() calls.

--
> ================================================== ============ <
> wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wu******@dm.net | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <

Feb 24 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dave | last post by:
Help! When I try to run tblimp from the command line I get the following error: tblimp is not recognized as an internal or external command. tblimp.exe is not on my harddrive at all. What...
9
by: shaddock | last post by:
Hello, When trying to run the InstallUtil.exe, I get the error below. Any insights? 'installutil' is not recognized as an internal or external command, operable program or batch file. ...
3
by: al.cpwn | last post by:
do static and inline functions or members have internal linkage? I have been reading this newsgroup on google and found conflicting ideas. Can someone please help me understand why in some places...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
2
by: gopal | last post by:
static void Main(string args) { .... .... } I have an EXE now. I am now giving one of the arguments as
2
by: =?Utf-8?B?anVuaW9yLWdlZWtldHRl?= | last post by:
I have seen similar questions posted here but no result for my situation so here goes. I have a fairly new Maxtor OneTouch III Turbo Terabyte external drive (raid) and a new Dell 690 Precision...
2
savanm
by: savanm | last post by:
i downloaded modules from cpan.... when i type perl -V:make i get make= 'nmake' bt if i type nmake There is a error occured like this: 'nmask' is not recognized as an internal or external...
8
by: crs27 | last post by:
Hai, can anyone tel me what dose this error mean. 'more' is not recognized as an internal or external command, operable program or batch file.
2
by: Paridevi | last post by:
Hai , i m facing a problem in .Net.When i create a New Project or Open an Existing File it Shows a Message The Web server reported the following error when attempting to create or open...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.