nok*_*eat 3 powershell batch-file
我正在引用这个问题 ASSIGN win XP命令行输出到变量
我试图在powershell代码段上使用它,所以我输入
powershell date (get-date).AddDays(-1) -format yyyyMMdd
Run Code Online (Sandbox Code Playgroud)
并确认它返回如
20100601
Run Code Online (Sandbox Code Playgroud)
但是如果我试着的话
for /f "tokens=*" %a in ('powershell date get-date -format yyyyMMdd
') do set var=%a
Run Code Online (Sandbox Code Playgroud)
然后它没能按预期工作.如何将日期转移到变量?
也许
for /f "tokens=*" %a in ('powershell "get-date; get-date -format yyyyMMdd"') do set var=%a
Run Code Online (Sandbox Code Playgroud)
是你想要的.
归档时间: |
|
查看次数: |
3803 次 |
最近记录: |