如何使用Windows Script Host复制文件?

时间:2019-05-17 17:38:59

标签: windows file copy host

此代码有错误,我无法跟踪它,我认为带有“ CopyFile”命令的行是错误的,如何在该行中调用字符串变量?

我已经阅读了有关Windows Script Host和JScript的信息,但找不到任何解决方案

@if (@X)==(@Y) @end

@echo off
cscript //E:JScript //nologo "%~f0"
exit /b 0
*------------------------------------------------------------------------------*/

function GetCurrentDate() {
var todayDate = new Date();
fso = CreateObject("Scripting.FileSystemObject");
    for (i = 1; i <= 16; i++){
        origen="D:/Peru/Canal-"+ 
                ("0" + i).slice(-2)
                +"/"+ todayDate.getFullYear()+"/"+
                ("0" + (todayDate.getMonth() + 1)).slice(-2)+
                "/"+"PerC"+("0" + i).slice(-2)+"CP201803201445.png";
        destino="C:/prueba01 - copy/sigap/media/PerC"+("0" + i).slice(-2)+"CP201803201445.png";
        fso.CopyFile origen, destino, TRUE;
    }
}

我想将16个文件从D复制到C

0 个答案:

没有答案