Running diskpart /s fred.txt in post-setup before login

RBCC

Member
Messages
54
Reaction score
0
Fred.txt is in the \$OEM$\$$\Setup\Files folder and I am using command with diskpart /s ~dpo fred.txt, am I doing this right? or do use the Run command??
 
~dp0 is a CMD path variable which is provisioned when you execute a batch file.

1. If you add a non-script file to Post-Setup, it's copied to "\Windows\Setup\Files".

2. NTLite will create a SetupComplete.cmd batch file to hold (Before logon) commands, but it lives in "\Windows\Setup\Scripts". These two folders have different paths, so ~dp0 is not useful.

You can add the command "diskpart /s C:\Windows\Setup\Files\fred.txt", (using an absolute path).
 
Another solution is to use a self-contained batch file, which pipes the same lines into diskpart without needing any saved files. If you're piping output, there is no need for an "exit" at the end. diskpart will exit by itself when the pipe is closed (after reading the last command).

fred.bat
Code:
(
    echo select disk 0
    echo clean
    echo convert gpt
    echo create partition efi size=100
    echo format quick fs=fat32 label="System"
    echo create partition msr size=16
    echo create partition primary
    echo shrink minimum=500
    echo format quick fs=ntfs label="Windows"
    echo create partition primary
    echo format quick fs=ntfs label="Recovery"
    echo set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
    echo gpt attributes=0x8000000000000001
) | diskpart
 
Back
Top