zoukankan      html  css  js  c++  java
  • 读取txt文本中每一条路径(一行)并判断,路径不存在的保存在另一txt文本中

    @echo off 
    for /f "tokens=2,*" %%i in ('reg query "HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v "Desktop"') do (
    set desk=%%j
    )
    echo %date:~0,4%年%date:~5,2%月%date:~8,2%日  %time:~0,8% >> %desk%checkFilePath.txt
    echo 以下文件路径不存在 >> %desk%checkFilePath.txt
    for /f %%i in (path.txt) do (
    if not exist "%%i" (@echo %%i >> %desk%checkFilePath.txt)
    )

    效果如下:

    更新之后大代码:

    @echo off 
    for /f "tokens=2,*" %%i in ('reg query "HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v "Desktop"') do (
    set desk=%%j
    )
    if exist %desk%CheckMTP.txt (del %desk%CheckMTP.txt)
    echo Following Paths do not exist or can't access to >> %desk%CheckMTP.txt
    set var=true
    for /f "tokens=*" %%i in (\bvtsrv2	eamv-jenkinFileMTP.txt) do (
    echo %%i
    if not exist "%%i" (  
    set var=false
    @echo %%i >> %desk%CheckMTP.txt)
    )
    if "%var%"=="true" (
        del %desk%CheckMTP.txt
        echo All paths are correct >> %desk%CheckMTP.txt
    )
    pause

     修订版:增加了ID读取

    @echo off 
    for /f "tokens=2,*" %%i in ('reg query "HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v "Desktop"') do (
    set desk=%%j
    )
    if exist %desk%CheckInsertion.txt (del %desk%CheckInsertion.txt)
    echo Following Paths do not exist or can't access to >> %desk%CheckInsertion.txt
    set var=true
    for /f "delims=; tokens=1-2" %%i in (\bvtsrv2	eamv-jenkinFileInsertion2.txt) do (
    echo %%i   
    if not exist "%%i" (   
    set var=false
    @echo %%i  %%j >> %desk%CheckInsertion.txt)
    )
    if "%var%"=="true" (
        del %desk%CheckInsertion.txt
        echo All paths are correct >> %desk%CheckInsertion.txt
    )
    pause
  • 相关阅读:
    cocos2d-x lua 学习笔记(1) -- 环境搭建
    Cocos2d-x 3.x 如何编译成安卓程序
    Cocos2d-x 3.4 初体验——安装教程
    cocos2d-x 之 CCProgressTimer
    android sdk离线安装
    在cocos2d-x-3.0 android 平台编译时提示CocosGUI.h: No such file or directory
    cocos2d_x iconv转码
    cocos2d-x发生undefined reference to `XX'异常 一劳永逸解决办法
    libjpeg.a exists or that its path is correct
    UE4插件
  • 原文地址:https://www.cnblogs.com/Jian-Zhang/p/6063754.html
Copyright © 2011-2022 走看看