Advertisement
teknoraver

zero

Aug 7th, 2020 (edited)
1,932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # fills the free space on disk with zeroes
  2.  
  3. $buf = [byte[]](1024 * 1024);
  4. $path = "$CWD\zero";
  5.  
  6. $file = [IO.File]::Create($path, $buf.Length, [IO.FileOptions]::DeleteOnClose);
  7.  
  8. try {
  9.     while(1) {
  10.         $file.Write($buf, 0, $buf.Length);
  11.     }
  12. } catch {
  13. }
  14.  
  15. $file.Flush();
  16. $file.Close();
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement