Pages

9/19/2014

Powershell - Date String for File Name

I often need to create a temp file or output file and want to make it unique. Using the date and time can be a good way to do that. For example:

$now = get-date -format yyyyMMddHHmmss
$outfile = $now + ".csv"

No comments: