小编Mic*_*ky 的帖子

在 Powershell 中创建带有日期和时间戳的文件

我想创建一个名称为当前时间的文件。我已经尝试过下面的代码,但它不起作用:

$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)

powershell timestamp file

1
推荐指数
1
解决办法
5756
查看次数

标签 统计

file ×1

powershell ×1

timestamp ×1