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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executing a batch file

Status
Not open for further replies.

msalvador

Programmer
Nov 13, 2001
33
0
0
IT
it's possible executing a batch file via xp_cmdshell command
i try to do this but query analyser write me
EXEC master..xp_cmdshell 'c:'
EXEC master..xp_cmdshell 'cd\'
EXEC master..xp_cmdshell 'sendmail'

The name specified is not recognized as an
internal or external command, operable program or batch file.
 
Hello,

You can write the dos commands as batch file and save it externally to a path and run via the Query analyser with the full path.

For ex:
Suppose, as you mentioned in your question comprise the dos commands as a batch file and store it as sample.bat in c drive or d drive or at any whare you want, and run

exce master..xp_cmdshell 'c:\sample.bat'

it will give the result what u want.

Madhu.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top