
标题: [文件操作] 批处理如何实现文件夹改名,并新建文件夹? [打印本页]
作者: ykhq2021 时间: 2021-6-6 17:19 标题: 批处理如何实现文件夹改名,并新建文件夹?
当前目录 下有文件名为 1
运行批处理后,将此文件夹改名为 系统当前日期+时间 格式如 20200606_171818
同时建立一个文件 命名为 1
感谢
作者: went 时间: 2021-6-6 17:38
- @echo off & cd /d "%~dp0"
- powershell -c "(Get-Date).ToString('yyyyMMdd_HHmmss')" | (
- set /p "d="
- call rename "1\" "%%d%%"
- mkdir "1"
- )
- pause&exit
复制代码
作者: Batcher 时间: 2021-6-6 18:06
回复 1# ykhq2021 - @echo off
- for /f %%i in ('powershell -c "Get-Date -UFormat '%%Y%%m%%d_%%H%%M%%S'"') do (
- ren "1" "%%i"
- )
- md "1"
复制代码
作者: ykhq2021 时间: 2021-6-6 20:05
回复 2# went
感谢
作者: ykhq2021 时间: 2021-6-6 20:06
回复 3# Batcher
感谢
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |