WinRAR & xp_cmdshell

Posted on 2009-12-21
Last Modified: 2013-12-01
I'm having difficulty getting the following code to execute:

exec master..xp_cmdshell '"c:\program files\winrar\winrar.exe" x -o+ "\\fs1\myshare\*.zip" "\\fs1\myshare\"'

I'm getting the error msg "'c:\program' is not recognized as an internal or external command, operable program or batch file.

Any suggestions?

Question by:hennessym
    LVL 75

    Accepted Solution

    exec master..xp_cmdshell '"c:\program~1\winrar\winrar.exe" x -o+ "\\fs1\myshare\*.zip" "\\fs1\myshare\"'
    LVL 1

    Author Comment

    Thanks - that worked once I changed program~1 to progra~1, but WinRar seemed to hang, so I just created a scheduled task to unzip the files and avoid xp_cmdshell entirely.

    Because you did answer the question I asked, however, I'm still awarding you points.

    Thanks again for such a quick response!

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now