Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Diskpart and logging output

3,024 views
Skip to first unread message

foxidrive

unread,
Apr 9, 2013, 10:19:57 PM4/9/13
to
This page says that diskpart output can be logged.

http://technet.microsoft.com/en-us/library/cc766465%28v=WS.10%29.aspx

To redirect DiskPart's scripting output to a file, type:

diskpart /s scriptname .txt > logfile .txt



However in Windows 8 this batch file creates a 0 byte list.txt file and the diskpart screen pops up in
another window momentarily and then disappears. Is this the behaviour for others too?


@echo off
> script.tmp echo list disk
>> script.tmp echo exit

diskpart /s "%cd%\script.tmp" >"list.txt"
del script.tmp

:: use timeout if you are using another diskpart command.
:: timeout /t 15

type list.txt
set /p "disk=Enter the disk number: "
set disk
pause




The other funny thing is that diskpart cannot find the script in the current folder without specifying
the %cd% path.


--
foxi

Bob

unread,
Apr 9, 2013, 11:20:52 PM4/9/13
to
On 4/9/2013 10:19 PM, foxidrive wrote:
> However in Windows 8 this batch file creates a 0 byte list.txt file and the diskpart screen pops up in
> another window momentarily and then disappears. Is this the behaviour for others too?

Greetings foxidrive, here are my results from your posted batch file
using WIN7:

C:\>check_disk.bat
Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: LAPTOP

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 3072 KB

Leaving DiskPart...
Enter the disk number: 0
disk=0
Press any key to continue . . .

===Below are the contents of list.txt===

Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: LAPTOP

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 3072 KB

Leaving DiskPart...

Later.


Bob

unread,
Apr 9, 2013, 11:48:00 PM4/9/13
to
On 4/9/2013 10:19 PM, foxidrive wrote:
> However in Windows 8 this batch file creates a 0 byte list.txt file and the diskpart screen pops up in
> another window momentarily and then disappears. Is this the behaviour for others too?

foxidrive,
I posted in haste without trying your code a second time using
VirtualXP. My results are below.

C:\>check_disk.bat

Microsoft DiskPart version 5.1.3565

Copyright (C) 1999-2003 Microsoft Corporation.
On computer: VIRTUALXP-42799

Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 127 GB 0 B

Leaving DiskPart...
Enter the disk number: 0
disk=0
Press any key to continue . . .

===Contents of list.txt===

Microsoft DiskPart version 5.1.3565

Copyright (C) 1999-2003 Microsoft Corporation.
On computer: VIRTUALXP-42799

Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 127 GB 0 B

Leaving DiskPart...

Later.


foxidrive

unread,
Apr 9, 2013, 11:47:48 PM4/9/13
to
Thanks for testing that Bob: that's what I expected but it seems that Windows 8 broke diskpart for some
reason.



--
foxi

foxidrive

unread,
Apr 10, 2013, 12:10:27 AM4/10/13
to
On 10/04/2013 1:48 PM, Bob wrote:
> On 4/9/2013 10:19 PM, foxidrive wrote:
>> However in Windows 8 this batch file creates a 0 byte list.txt file and the diskpart screen pops up in
>> another window momentarily and then disappears. Is this the behaviour for others too?
>
> foxidrive,
> I posted in haste without trying your code a second time using
> VirtualXP. My results are below.
>

Thanks Bob. That shows it works as expected everywhere else apart from Windows 8.

> ===Contents of list.txt===
>
> Microsoft DiskPart version 5.1.3565
>
> Copyright (C) 1999-2003 Microsoft Corporation.
> On computer: VIRTUALXP-42799
>
> Disk ### Status Size Free Dyn Gpt
> -------- ---------- ------- ------- --- ---
> Disk 0 Online 127 GB 0 B
>
> Leaving DiskPart...


--
foxi

keo...@gmail.com

unread,
Apr 17, 2014, 12:01:42 PM4/17/14
to
This may be too late to matter but if you run elevated in Windows 8 it works as expected.
0 new messages