::120为多少秒
for /f "delims=" %%a in ('dir /a-d/s/b "E:\上传
文件
\ceshi\data2\*"') do (
if !n! equ %s% (
set n=0
ping 127.0.0.1 -n "120">nul
set /a n...
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class CopyTest {
public static void main(String[] args) throws Exception {
//输出字节流,读
文件
FileInputStre
:: Set current time string to Global value, other
bat
ch file can use it.
set currentDateYear=%date:~0,4%
set currentDateMonth=%date:~5,2%
set currentDateDay=%date:~8,2%
set timeTemp=%time: =0%
set curr
需要将一个
文件
重命名为当天日期,并每天自动剪切到指定目录(可以跨磁盘)。
以处理一张图片为例。将该图片更名为日期,并从D盘目录剪切到C盘指定目录。将2.jpg
文件
和该
bat
文件
置于同一目录下。
set oldName=2.jpg
set newName=%date:~0,10%
ren %oldName% %newName:/=-%.jpg
set sourceDir=D:\123%newName:/=-%.jpg
set targetDir=C:\123
xcopy /s /e /i /y %source
setlocal enabledelayedexpansion
set "text="
for /f "tokens=1,2* delims=: " %%a in ('time /t') do (
set "hour=%%a"
set "minute=%%b"
set "second=%%c"
set "filename=%hour%_%minute%_%second%.txt"
echo %filename%
set "text="
for /f "tokens=*" %%a in ('powershell.exe -command "Add-Type -AssemblyName PresentationCore;[Windows.Clipboard]::GetText()"') do set "text=%%a"
echo %text% > %filename%
powershell.exe -command "Add-Type -AssemblyName PresentationCore;[Windows.Clipboard]::SetText('%text%')"