Creating Large Dummy Files With .NET

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

You can always resort to the underlying .NET framework whenever the functionality you need isn't available through a cmdlet.

The following code is a very fast way to generate really large test files:

$path = "$env:temp\testfile.txt"
$file = [io.file]::Create($path)
$file.SetLength(1gb)
$file.Close()
Get-Item $path

Twitter This Tip! ReTweet this Tip!


Posted Mar 11 2010, 08:00 AM by ps1

Comments

Creating Large Dummy Files With .NET « whileloop wrote Creating Large Dummy Files With .NET « whileloop
on 03-12-2010 10:01 PM

Pingback from  Creating Large Dummy Files With .NET « whileloop

Episode 105 – PSCX 2.0 with Keith Hill and Oisin Grehan « PowerScripting Podcast wrote Episode 105 – PSCX 2.0 with Keith Hill and Oisin Grehan « PowerScripting Podcast
on 03-14-2010 9:42 PM

Pingback from  Episode 105 – PSCX 2.0 with Keith Hill and Oisin Grehan «  PowerScripting Podcast

Copyright 2012 PowerShell.com. All rights reserved.