I have created a small batch file that does the following, as a test for xp_cmdshell:
echo %1
dir %1
C:
cd %1
dir
The batch file has been saved to c:\test.bat.
I then try to run the batch file using query analyser to run this command: exec master.dbo.xp_cmdshell 'c:\test.bat'.
I receive the following error.
However running exec master.dbo.xp_cmdshell 'dir C:\*.*' works without any problems.
My SQL server is running version 8.00.760 (sp4). I am using the SA account to run the command.
Whats the problem with trying to run the batch file?
------------------------
Hit any User to continue
echo %1
dir %1
C:
cd %1
dir
The batch file has been saved to c:\test.bat.
I then try to run the batch file using query analyser to run this command: exec master.dbo.xp_cmdshell 'c:\test.bat'.
I receive the following error.
SQL Server said:'c:\test.bat' is not recognized as an internal or external command operable program or batch file.
However running exec master.dbo.xp_cmdshell 'dir C:\*.*' works without any problems.
My SQL server is running version 8.00.760 (sp4). I am using the SA account to run the command.
Whats the problem with trying to run the batch file?
------------------------
Hit any User to continue