Hello, I am trying to create a .bat that uses PsExec to open Diskpart on a server and format a specific drive but the bat file stops running after it opens disk part.
Below is my current .bat:
cd .\NO TOUCH\
.\PsExec.exe \\[IP ADDRESS] -u [USERNAME] -p [PASSWORD] diskpart
list disk
select disk 1
format
When I run the batch it opens up CMD waiting for me to put commands into diskpart
I have tried swapping out "list disk select disk 1 format" with "http:www.google.com" and it does the same thing, no mater what I put after it it just stops at diskpart
Any help?
Can't get batch file to input commands into Diskpart
Moderator: DosItHelp
-
- Posts: 1
- Joined: 21 Jun 2018 14:18
Re: Can't get batch file to input commands into Diskpart
The diskpart commands can be placed in a text file (one command per line) and used as an input file to diskpart.exe:
DiskPart.exe < myscript.txt
or
diskpart /s scriptname.txt
DiskPart.exe < myscript.txt
or
diskpart /s scriptname.txt