You may wish to execute several MS-DOS (Windows Shell) commands in just one line. You just have to concatenate the commands with the & sign:

C:\>cd Windows & dir *.tmp
 Volume in drive C has no label.
 Volume Serial Number is B818-09FC

 Directory of C:\WINDOWS

28.12.2006 г.  22:01         19 569 003114_.tmp
04.08.2004 г.  15:00         1 042 903 SET3.tmp
04.08.2004 г.  15:00         1 086 058 SET4.tmp
04.08.2004 г.  15:00            13 753 SET8.tmp
               4 File(s)      2 162 283 bytes
               0 Dir(s)   7 372 824 576 bytes free

C:\WINDOWS>

This is extremely important to know if you’re calling an executable through the xp_cmdshell extended procedure with MS SQL Server.

For example, you may need to change the current directory before calling the executable. This is typically the case if you’re calling formatdb through xp_cmdshell:

EXEC master..xp_cmdshell 'd: & cd FastaExports & formatdb ...'

Post a Comment

*
*