title: Powershell Large File Creation to Size with Data
body: <p>I am trying to determine what Powershell command would be equivalent to the following Linux Command for creation of a large file in a reasonable time with exact size AND populated with the given text input.</p>
  <p><a href="https://stackoverflow.com/questions/66018261/powershell-large-file-creation-to-size-with-data">New Question asked as this one was automatically closed for some reason.</a></p>
  <p>Given:</p>
  <pre><code>$ cat line.txt
   !&quot;#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ZZZZ
  
  $ time yes `cat line.txt` | head -c 10GB &gt; file.txt  # create large file
  real    0m59.741s
  
  $ ls -lt file.txt
  -rw-r--r--+ 1 k None 10000000000 Feb  2 16:28 file.txt
  
  $ head -3 file.txt
  !&quot;#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ZZZZ
  !&quot;#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ZZZZ
  !&quot;#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ZZZZ
  
  </code></pre>
  <p>What would be the most efficient, compact Powershell command which would allow me to specify the size, text content and create the file as the Linux command above? Thanks!</p>