Skip to content

Instantly share code, notes, and snippets.

@jeevan-vj
Created June 3, 2019 10:37
Show Gist options
  • Save jeevan-vj/6287da97d8b62c618552a5f3ac07210b to your computer and use it in GitHub Desktop.
Save jeevan-vj/6287da97d8b62c618552a5f3ac07210b to your computer and use it in GitHub Desktop.
try
{
$fs = [System.IO.FileStream]::New('c:\tempfiles\largefile.txt', [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write, [System.IO.FileShare]::None)
$fs.SetLength(2 * 1024 * 1024 * 1024 -1)
}
finally
{
if ($null -ne $fs -and $fs -is [System.IDisposable])
{
$fs.Dispose()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment