Batch file script to format partition

August 22, 2019 at 03:35:29
Specs: Windows 10
Dears,

I want a batch script to automatically format a partition in windows when any program copying files pop up "Insufficient disk space"

Anybody please help me,


See More: Batch file script to format partition

Reply ↓  Report •

#1
August 22, 2019 at 04:00:11
Batch is definitely not suitable for that, im not even sure if powershell is viable.

You might be able to make a task in task scheduler that triggers on receiving a "Insufficient disk space" event in event viewer.

I just about got 0 experience with that tho, i'dd say check back in a day or 5.

i5-6600K[delid]@4.833GHz Core/4.632GHz cache@1.456v | 2x4GB Crucial-DDR4-2400MHzCL17@3018MHzCL12@1.465v | Sapphire Nitro+ SE RX 590 8GB@1650Mhz core@1.15v/2236MHz@1500MHz timings BiosModded


Reply ↓  Report •

#2
August 22, 2019 at 04:04:18
If you get that message there will be files in use on the partition. You can't use the "format" command if files on the partition are in use.

Reply ↓  Report •

#3
August 22, 2019 at 06:15:09
I'm just assuming you need a script to format a partition, not also a triggering system that checks for full partitions/disks. That is what your title states: need a script. ( Just for info, batch processing can check disk free space on any disk, it's quite easy: just look for any command that shows that info a screen, like DIR or CHKDSK, and go from there.)

Well, that is possible using scripts. For example, you can unmount active processes from a non-system disk by using the CHKDSK command with /X option. It's not like an "eject" in Windows, but it is similar. Then, when the filesystem has no processes linked to it, you can format it with FORMAT.COM - I see you have Windows 10, I hope that is still there, it is on Windows 7. But, the web has non-Windows-native command line formatting tools, I'm sure.

The biggest problem however is that, IF you make a mistake, and format the wrong disk, you are in serious trouble. Then again, there's plenty of ways to reduce that risk, when using scripting.

message edited by Looge


Reply ↓  Report •

Related Solutions

#4
August 22, 2019 at 09:55:40
Thank for all for positive response but my problem is not solved yet.
Let I explain my problem in detail,

I am using "Iperius Backup" tool for making windows image backup of system partition. This software is good in sense that it can make backup in windows image format (.vhd or .vhdx) without any issues/errors and according to more selected schedule than Windows builtin backup process. While backing up, the backup partition is being filled with passage of time and ultimately Backup program pops up "The backup discarded due to insufficient disk space". It is because the Developers of this tool did not given any option to manage backup partition space automatically. However,there is an option that I can run any executable program when backup completed every time and can start the next backup after that.

Now, I want a batch script or any other way through which I can command to backup software to format the backup partition when it failed to create backup due to insufficient disk space and next backup will be started in an empty partition. In this way, I can continue backup without manually format the backup partition.


Reply ↓  Report •

Ask Question