Remove gargage characters
Posted: 11 Nov 2020 12:02
I have a bat file that I would like to find a solution remove the garbage characters after Diskpart runs.
" ÿþ"
The bat file:
The output file looks like this:
" ÿþ"
The bat file:
Code: Select all
bcdedit /enum all >"%~dp0FixBootBCD.txt"
bcdedit | find "osdevice" >>"%~dp0FixBootBCD.txt"
(echo SELECT DISK 0
echo SELECT PARTITION 1
echo GPT ATTRIBUTES=0x0000000000000001
echo active
echo exit
) | diskpart >>"%~dp0FixBootBCD.txt"
bootrec /rebuildbcd >>"%~dp0FixBootBCD.txt"
bootrec /fixmbr >>"%~dp0FixBootBCD.txt"
bootrec /fixboot >>"%~dp0FixBootBCD.txt"
bootrec /scanos >>"%~dp0FixBootBCD.txt"
bootsect /nt60 C: >>"%~dp0FixBootBCD.txt"
bcdboot C:\Windows >>"%~dp0FixBootBCD.txt"
attrib -h C:\EFI\Microsoft\Boot\*.* >>"%~dp0FixBootBCD.txt"
dir C:\EFI\Microsoft\Boot\*.* >>"%~dp0FixBootBCD.txt"
@cmd /k
Code: Select all
DISKPART>
Leaving DiskPart...
ÿþS c a n n i n g a l l d i s k s f o r W i n d o w s i n s t a l l a t i o n s .
P l e a s e w a i t , s i n c e t h i s m a y t a k e a w h i l e . . .
S u c c e s s f u l l y s c a n n e d W i n d o w s i n s t a l l a t i o n s .
T o t a l i d e n t i f i e d W i n d o w s i n s t a l l a t i o n s : 0
T h e o p e r a t i o n c o m p l e t e d s u c c e s s f u l l y .
ÿþT h e o p e r a t i o n c o m p l e t e d s u c c e s s f u l l y .
ÿþT h e o p e r a t i o n c o m p l e t e d s u c c e s s f u l l y .
ÿþS c a n n i n g a l l d i s k s f o r W i n d o w s i n s t a l l a t i o n s .
P l e a s e w a i t , s i n c e t h i s m a y t a k e a w h i l e . . .
S u c c e s s f u l l y s c a n n e d W i n d o w s i n s t a l l a t i o n s .
T o t a l i d e n t i f i e d W i n d o w s i n s t a l l a t i o n s : 0
T h e o p e r a t i o n c o m p l e t e d s u c c e s s f u l l y .
Target volumes will be updated with BOOTMGR compatible bootcode.
C: (\\?\Volume{1ddbcde8-60bc-4d00-aacf-9efdb7621e4e})
Successfully updated NTFS filesystem bootcode.
Bootcode was successfully updated on all targeted volumes.
Failure when attempting to copy boot files.
Path not found - C:\EFI\Microsoft\Boot