# Target file size in bytes (2 Gigabytes) target_size = 2 * 1024 * 1024 * 1024 file_name = "2gb_sample.txt"
$file = New-Object System.IO.FileStream "C:\temp\2GB-real.bin", Create, ReadWrite $file.SetLength(2GB) $file.Close() 2gb sample file
Several reputable sites provide these files for free to help with testing: # Target file size in bytes (2 Gigabytes)
If your goal is to "prepare" the file for someone else, you can use these free transfer services: How to Create a Dummy Test File of Any Size in Windows 2gb sample file
# Target file size in bytes (2 Gigabytes) target_size = 2 * 1024 * 1024 * 1024 file_name = "2gb_sample.txt"
$file = New-Object System.IO.FileStream "C:\temp\2GB-real.bin", Create, ReadWrite $file.SetLength(2GB) $file.Close()
Several reputable sites provide these files for free to help with testing:
If your goal is to "prepare" the file for someone else, you can use these free transfer services: How to Create a Dummy Test File of Any Size in Windows