Solved Generate and append Dxdiag data to a Text file

January 27, 2012 at 07:03:40
Specs: Windows 7

I need to generate a DxDiag report and then append it to an all encompassing report using one single bat file. But the script keeps giving me an error message that the file can not be found. To generate the dxdiag I've used:

dxdiag /t C:\General\Reports\dxdiag.txt

I have then used the type command to try to append the Dxdiag data into the report:

type "C:\General\Reports\dxdiag.txt" >Fullreport.txt

But it keeps telling me the file can not be found, even though I can see that the file is being generated by the first command in the specified path.

Wondering if you could shed some light into this noobie's confusion.

Thanks in advanced!


See More: Generate and append Dxdiag data to a Text file

Report •

January 27, 2012 at 09:36:14
✔ Best Answer
Dxdiag needs a relevant time interval to execute so if the Type command immediately follows it the result file may still be not generated. While executables inside a batch perform sequentially, dxdiag natively runs in multitask mode so the script flow must be explicitly synchronized coding

start "" /Wait dxdiag /T C:\General\Reports\dxdiag.txt
type C:\General\Reports\dxdiag.txt >> Fullreport.txt

Better you use the >> redirector that appends the text otherwise you will overwrite the previous content of the target file.

Report •

January 27, 2012 at 09:36:27
try doing this in a batch file

dxdiag /t dxdiag.txt
if exist dxdiag.txt (echo File exists & type dxdiag.txt >> fullreport.txt) else echo File Does Not Exist & goto end
if exist fullreport.txt echo File Safely appended to fullreport.txt

if that works in the CURRENT directory, then you can add the full path to the files. If that DOESNT work, then you might have permission issues with the folder. You can use the %temp% variable as a safe location to put your files in (for testing purposes)


Report •

January 30, 2012 at 02:47:10
Thank you! Ye were really helpful!

Report •

Related Solutions

Ask Question