.ps1脚本执行

该脚本基于 powershell 执行,使用方法:

进入脚本所在文件夹,右键脚本文件使用 powershell 打开。

注意:

  • 脚本执行需要powershell开启允许执行本地脚本,以管理员身份运行powershell,在powershell中输入以下命令开启策略:

    Set-ExecutionPolicy RemoteSigned
  • 第一次运行脚本会在同级目录中创建三个文件:

    • source_folder_path.txt:存放源文件夹信息
    • target_folder_path.txt:存放目标文件夹信息
    • ScriptLog.txt:脚本执行日志信息
  • 你需要在source_folder_path.txttarget_folder_path.txt中填写源文件夹路径和目标文件夹路径。每个文件中填写的格式如下:

    source_folder_path.txt:
    C:\Users\wangyeh\Desktop\source
    C:\Users\wangyeh\Desktop\source2
    target_folder_path.txt:
    关键字1,C:\Users\yangzhenyu\Desktop\target
    关键字2,C:\Users\yangzhenyu\Desktop\target2