Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xp_cmdshell issue 1

Status
Not open for further replies.

SiJP

Programmer
May 8, 2002
708
GB
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.

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
 
Lemme guess: you created c:\test.bat on local drive... and SQL server is on another machine?

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
I feel like such a donut .. Its a client's network, I didn't even think to check that!




------------------------
Hit any User to continue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top