0

I want a .bat script to run on boot which will automatically increase the hard disk space.

diskpart
select volume 1
extend
exit

However that in a .bat file just runs the first command only. I can only get it working if I manually paste it into command prompt.

I have also tried with adding CALL before each command which did not work.

CALL diskpart
CALL select volume 1
CALL extend
CALL exit
Toodarday
  • 167
  • 3
  • 8
  • how did you manage to assume that completely made-up commands work? I think you should do a tutorial on computers before you start scripting ... – specializt Sep 25 '15 at 10:37

2 Answers2

1

Each line in a batch file represents a shell command or batch function. "select volume 1" is not a command that is recognized, it is text you wish to send to the running program. See how to pass input to .exe in batch file? to pass input to an executable, or find out if the executable supports scripting.

DiskPart does supports scripting. Put your script in a file, say "ExtendVolume1.txt":

select volume 1
extend
exit

Then run DiskPart:

diskpart /s ExtendVolume1.txt
Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
0
>diskpart /?

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

Microsoft DiskPart syntax:
        diskpart [/s <script>] [/?]

        /s <script> - Use a DiskPart script.
        /?          - Show this help screen.

A Description of the Diskpart Command-Line Utility

Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180