Solved

xp_cmdshell space

Posted on 2004-10-20
2
638 Views
Last Modified: 2006-11-17
I'm trying to something like the following:

Declare @myCommand varchar(255)
Set @myCommand = 'copy F:\Folder\SubFolder\file.txt  F:\Folder\SubFolder\my archive\file.txt'
EXEC xp_cmdshell @myCommand

I get an error "The syntax of the command is incorrect."

I believe this is due to the space in "my archive".  What am i doing wrong?  If it is the space, how do handle the syntax?
0
Comment
Question by:wordtool
2 Comments
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 20 total points
ID: 12365015
try

Set @myCommand = 'copy "F:\Folder\SubFolder\file.txt"  "F:\Folder\SubFolder\my archive\file.txt"'

other than that, I don't see any problems...
0
 

Author Comment

by:wordtool
ID: 12365064
Yes, the quotes work, thank you.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

910 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

23 Experts available now in Live!

Get 1:1 Help Now