DEV Community

redhcp
redhcp

Posted on

3 2

Create file with date in filename Powershell

Create file with date in filename, specific size

$FILENAME=get-date -format yyyyMMdd.HHmmssff
$MYARRAY = New-Object -TypeName Byte[] -ArgumentList 1Mb
$OBJ = New-Object -TypeName System.Random
$OBJ.NextBytes($MYARRAY)
Set-Content -Path $FILENAME".txt" -Value $MYARRAY -Encoding Byte

Write-Host "The file was created in" $((pwd).path) -foregroundcolor "green"

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site