devxlogo

Running DOS Commands in SQL Server Query Analyzer

Running DOS Commands in SQL Server Query Analyzer

If you run this statement In SQL Server Query Analyzer:

 EXEC master..xp_cmdshell 'dir *.exe'

You will get the result as DOS DIR Command. Using this, you can run all DOS commands.
A sample result looks like this:

 09/21/01  08:25a                26,384 actmovie.exe09/24/01  10:07a               118,032 addgrpw.exe09/21/01  08:25a               155,920 addusrw.exe10/14/96  07:08a                10,774 append.exe04/29/99  12:04p                21,264 ARP.EXE10/14/96  07:08a                27,920 at.exe04/29/99  12:04p                22,800 ATSVC.EXE10/14/96  07:08a                27,920 attrib.exe09/21/01  08:25a               153,088 AUTMGR32.EXE
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist