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)
 TSQL for xp_cmdshell

Author  Topic 

dewacorp.alliances

452 Posts

Posted - 2006-10-23 : 02:33:45
I am trying to run the following script:

DECLARE  @rc int

EXEC @rc = master.dbo.xp_cmdshell 'C:\Program Files\Resource Kit\Robocopy.exe'
print @rc


I got the following error:

'C:\Program' is not recognized as an internal or external command,


Is there especially character that you need to put in to ignore spacing or special character like @ in front of string in C# ?

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-23 : 02:35:05
[code]
EXEC @rc = master.dbo.xp_cmdshell '"C:\Program Files\Resource Kit\Robocopy.exe"'
[/code]


KH

Go to Top of Page

dewacorp.alliances

452 Posts

Posted - 2006-10-23 : 19:46:19
Thank you so much ... don't realise need to put double quote within single quote.
Go to Top of Page

nosepicker
Constraint Violating Yak Guru

366 Posts

Posted - 2006-10-24 : 19:24:12
You need to use double quotes here because the command line interprets the first space as the end of a command. Putting double quotes around the path tells the command line to treat the entire text within the quotes as a single command. Of course Microsoft, in all of their wisdom, for some reason decided to use a folder with a space in its name (Program Files) as their default location for installing programs.
Go to Top of Page
   

- Advertisement -