Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Winzip Problem with xp_cmdshell

Author  Topic 

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-06-02 : 05:01:10
When I run this command
exec master..xp_cmdshell 'c:\program files\winzip\winzip32.exe –min –a –r -en c:\atlas\Users.zip c:\atlas\Users.txt'

I got the error
C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Please help me how can I resolve this isse

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-06-02 : 05:14:49
try putting the dos command into a .bat file an run that.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2005-06-02 : 05:19:48
It needs to be encapsulated in quotes because of the space between program and files

exec master..xp_cmdshell '"c:\program files\winzip\winzip32.exe" –min –a –r -en c:\atlas\Users.zip c:\atlas\Users.txt'


Edit:
Double quotes "

Andy

Beauty is in the eyes of the beerholder
Go to Top of Page

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-06-02 : 05:32:03
"c:\program files\winzip\winzip32.exe" -min -a -r -en c:\ntest\Users.zip c:\ntest\Users.txt

this runs fine in batch fine but when I run
exec master..xp_cmdshell '''c:\program files\winzip\winzip32.exe'' -min -a -r -en c:\ntest\Users.zip c:\ntest\Users.txt'

it gives error
The filename, directory name, or volume label syntax is incorrect.
NULL
Go to Top of Page

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-06-02 : 05:43:19
But when I run this in query analyzer it keeps on running. I want to perform this task in a job please help me how may I do this.
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-06-02 : 05:46:42
It's probably waiting to have the I Agree button clicked by the Service, which of course will never happen. You have to be very careful running windows apps under this context.

There is a good free command line zip application here http://unxutils.sourceforge.net/


Damian
Ita erat quando hic adveni.
Go to Top of Page

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-06-02 : 05:54:21
Can you tell me the name of Utility on http://unxutils.sourceforge.net/
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-06-02 : 06:12:33
Download the package, unzip it.

The file you want has the highly unlikely name of.....


zip.exe





Damian
Ita erat quando hic adveni.
Go to Top of Page
   

- Advertisement -