Chuck another double quote at the end of the path, that'll work for ya.
Exec master..xp_cmdshell 'dir "d:\program files\Microsoft sql
server\mssql\backup" /b'
cheers
Colin MacKenzie
-----Original Message-----
From: Michael Metz [mailto:mjmetz@q...]
Sent: Wednesday, November 13, 2002 2:29 PM
To: sql language
Subject: [sql_language] DOS switches with xp_cmdshell
Hi,
The following works:
exec master..xp_cmdshell 'DIR "D:Program Files\Microsoft SQL
Server\MSSQL\Backup'
..but when I add switches to display just the filenames in all
subdirectories filenames it doesn't work:
exec master..xp_cmdshell 'DIR "D:Program Files\Microsoft SQL
Server\MSSQL\Backup /B'
..but if I do this it works:
exec master..xp_cmdshell 'DIR D: /A-D /S /B'
It appears the doublequote prior to the filepath doesn't work when using
switches. Is my syntax incorrect?
Thanks