I would like to embed diskpart command with my batch file.
for example "gpupdate.bat" is my batch file
@echo off
@echo off
cd: c:\windows\system32
gpupdate /force
exit
I want following commands to embed with above batch file (or separate batch file.)
diskpart
list vol
sel vol 1
remove letter=E
exit
I've tried the following method (detail below) but it DIDN'T WORK
create text file "removeletter.txt" with following commands
diskpart list vol sel vol 1 remove letter=E exit
open command prompt
c:\users\Admin diskpart /s removeletter.txt
nothing happens
but when I do it manually it works
cmd -> diskpart-> list vol-> sel vol 1=> remove letter=E
Best Answer
Writing your diskpart commands in a separate file should work. However, you don't need the
diskpart
command again at the top (just the commands after you call it), and the commands need to be on separate lines. And if you want this to be in a batch script, then you should calldiskpart
in a batch script that uses a text file.whatever.bat
removeletter.txt