I want to execute a command line utility using xp_cmdshell and return the results in CSV format for processing in a SQL Server table.
The command line with options/parameters:
tasklist /v /FO:CSV
The SQL script line is:
EXEC xp_cmdshell 'tasklist /v /FO:CSV'
The returned column names are:
Image Name, PID, Session Name, Session#, Mem Usage, Status, User Name, CPU Time, Window Title
It is important for me to take the "Window Title" info, but the window title always returns "N/A"
when I run command line using xp_cmdshell. When I run code directly in Windows Command Prompt, (cmd.exe), it returns the "Window Title" information I require.