2021年2月2日星期二

Powershell Large File Creation to Size with specified input Data

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.

Given:

$ cat line.txt   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ZZZZ    $ time yes `cat line.txt` | head -c 10GB > 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  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ZZZZ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ZZZZ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ZZZZ    

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! Original ask here was automatically closed for some reason

https://stackoverflow.com/questions/66019720/powershell-large-file-creation-to-size-with-specified-input-data February 03, 2021 at 08:50AM

没有评论:

发表评论