如何使用bat将文件夹复制到新创建的时间戳文件夹? [英] how to copy folders to a newly created timestamps folder using bat?
本文介绍了如何使用bat将文件夹复制到新创建的时间戳文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用bat将文件夹的副本发送到新创建的timestamp文件夹
I'm trying to send a copy of folder to newly created timestamp folder using bat
bat 'for /f "tokens=2-4 delims=/ " %%i in ("%date%") do md %%i_%%j_%%k'
我要从此位置复制文件夹
I want to copy folder from this location
"C:/Program Files (x86)/Jenkins/workspace/jenkins Pipeline/application/bin/Debug/netcoreapp2.1/linux-arm/publish"
并将其粘贴到新创建的时间戳文件夹中.我试过将CD刻录到该文件夹,但是如何给该文件夹命名?如何在时间戳文件夹名称中提及时间和日期? 我该怎么做?
and paste it in newly created timestamp named folder. I tried to CD to that folder but how can I give the name of the folder?also how to mention time along with date in timestamp folder name? how can I accomplish this?
推荐答案
您可以尝试以下操作:
@echo off
rem Create timestamp:
set "timestamp=%time:~0,2%_%time:~3,2%"
rem Create folder:
md %timestamp%
xcopy /E "C:/Program Files (x86)/Jenkins/workspace/jenkins Pipeline/application/bin/Debug/netcoreapp2.1/linux-arm/publish" "%timestamp%"
希望这会有所帮助!
这篇关于如何使用bat将文件夹复制到新创建的时间戳文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文