我想创建一个名称为当前时间的文件。我已经尝试过下面的代码,但它不起作用:
$Currentpath = split-path -parent $MyInvocation.MyCommand.Definition
$FileLogdate = Get-Date -format 'dd/MM/yyyy HH:mm:ss'
Write-Host($FileLogdate)
New-Item -Path $Currentpath -Name "$FileLogdate" -ItemType "file"
Run Code Online (Sandbox Code Playgroud)