August 9, 2006 at 7:40 am
I'm using a xp_cmdshell on SQL 2000 and it works fine, I run it from DOS and it works fine, the same line of command does not work on SQL SERVER 2005 it says "invalid drive specification", there is any trick with 2005?
thanks in advance
August 10, 2006 at 11:41 am
I believe that it has to do with the default directory and the lack of PATH information. First you need to determine where you are exeuting from then what PATH information is set for xp_cmdshell. Determiniing this is simple:
exec xp_cmdshell 'cd' --> this will return the surrent directory
exec xp_cmdshell 'echo %PATH% --> will return the current path information
Usually when I use xp_cmdshell I will do one of two things. I'll either fully qualify a one line command or use a .cmd file for a multiple line command starting it off with a "cd /d drive:\path".
If you are into arcane DOS syntax you can even turn a multiple line DOS command into a one liner by enclosing the command list in parens and separating the indicvdual commands by &&'s.
RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply