Page 1 of 1
stop DOS truncating column output
Posted: 03 Jul 2016 07:18
by confuseis
Hi
I want to stop DOS truncating output.
In this case I am using the "driverquery" command to list all the drivers
The column "Display name" has been shortened in the output to about 22 characters
id like to run the driverquery comand but show the full output for all its columns
I searched but cant find how to do this
Thanks for reading
Re: stop DOS truncating column output
Posted: 03 Jul 2016 07:59
by foxidrive
Code: Select all
driverquery /fo csv
driverquery /fo list
Use
driverquery /? for more info
Re: stop DOS truncating column output
Posted: 03 Jul 2016 09:20
by Compo
You need to indicate what you doing with the output, just looking at it or using it for something!
There is no way that you will be able to easily read that output data in a standard sized
(or usual) console window.
My output is more than 250 rows and 120 characters wide!It may also be useful if you provided us with the target Operating System.
Re: stop DOS truncating column output
Posted: 03 Jul 2016 15:10
by confuseis
I have tweaked the cmd.exe window size & buffer to comfortably fit the text into
I have tried every combination from the driverquery /? command
I see that the csv export does have the column headers with full info displayed however I require this in a text file
The export to text file has the columns squashed and it would not be inhibited by windows size etc.
The console output has the display njame column shortened also.
I need the output in a text file, the text file is for gathering diagnostic info from a machine
e.g. driverquery >> bleh.txt
Any way to tell cmd.exe not to do this in the output ?
The "display name" column is too short
Thanks
Re: stop DOS truncating column output
Posted: 03 Jul 2016 15:30
by Compo
Here's how I'd do it!
Code: Select all
@Powershell -ExecutionPolicy Bypass -C "DriverQuery.exe /FO CSV | ConvertFrom-CSV | Select-Object 'Module Name', 'Display Name', 'Driver Type', 'Link Date' | ft -Auto | Out-String -Width 4096 | Out-File output.log"
That's one single line.
Your output.log should contain what you need
Re: stop DOS truncating column output
Posted: 04 Jul 2016 11:03
by foxidrive
That works well here Compo.
Does this command work on machines that have never run powershell before, and so haven't been configured to run powershell scripts?
@Powershell -ExecutionPolicy Bypass
From appearance it would seem that it does.
I always thought that Powershell couldn't run on a machine which wasn't prepped in that way.
I've been wrong before though. I think the last time was in 1983 some time.
Re: stop DOS truncating column output
Posted: 04 Jul 2016 12:07
by Compo
As you have already found out, yes it does.
It's not usually something I'd recommend but for those who tend not to use powershell, (read as batch community), I'd prefer them to leave their machine set to it's default of not running scripts and use this for the odd occasion when it may be necessary to use it.
@confuseis, if you've already set your window to the sizes required then you could obviously remove the last piped 'Out-File' section of the command to see it in your open console window.
Re: stop DOS truncating column output
Posted: 04 Jul 2016 13:12
by confuseis
Yep Compo that powershell line works beautifully.
@Powershell -ExecutionPolicy Bypass -C "DriverQuery.exe /FO CSV | ConvertFrom-CSV | Select-Object 'Module Name', 'Display Name', 'Driver Type', 'Link Date' | ft -Auto | Out-String -Width 4096 | Out-File output.log"
Didnt know that trick, will be useful in future
Thats me sorted
Thanks all
Re: stop DOS truncating column output
Posted: 04 Jul 2016 13:29
by Aacini
Compo wrote:It's not usually something I'd recommend but for those who tend not to use powershell, (read as batch community), I'd prefer them to leave their machine set to it's default of not running scripts and use this for the odd occasion when it may be necessary to use it.
For such odd occasions I prefer to use this, simpler syntax:
Code: Select all
@Powershell DriverQuery.exe /FO CSV ^| ConvertFrom-CSV ^| Select-Object 'Module Name', 'Display Name', 'Driver Type', 'Link Date' ^| ft -Auto ^| Out-String -Width 4096 ^| Out-File output.log
Antonio
Re: stop DOS truncating column output
Posted: 04 Jul 2016 13:45
by Compo
Aacini wrote:Code: Select all
@Powershell DriverQuery.exe /FO CSV ^| ConvertFrom-CSV ^| Select-Object 'Module Name', 'Display Name', 'Driver Type', 'Link Date' ^| ft -Auto ^| Out-String -Width 4096 ^| Out-File output.log
It appears to do exactly what we wanted and despite the fact I have a Restricted ExecutionPolicy on this machine!
Whilst I'm here, I remembered Mr Benham once posting a solution to the change of window buffer width & height and thought I'd offer this as an alternative to view it in the window without pre-configuring the console.
Code: Select all
@Set/A W=130, H=260
@Powershell -C "&{$H=get-host;$R=$H.ui.rawui;$B=$R.buffersize;$W=$R.windowsize;$B.width=if (%W% -gt $W.width) {%W%} else {$W.width};$B.height=if (%H% -gt $W.height) {%H%} else {$W.height};$R.buffersize=$B};DriverQuery.exe /FO CSV | ConvertFrom-CSV | Select-Object 'Module Name', 'Display Name', 'Driver Type', 'Link Date' | ft -Auto"
@Timeout -1
It maintains the window width and height, but alters the buffer,
(set on line one), accordingly, allowing me to scroll and read.