如何制作一个找到文件路径并将特定文件复制到其他位置的bat文件

时间:2022-10-03 02:09:22

I want to make a bat file that first will search the path for the executable "Text.exe". Then i want to copy a log.log file from the path that i founded , in thr folder LOg and copy this file to a server \server1\logFiles

我想创建一个bat文件,首先将搜索可执行文件“Text.exe”的路径。然后我想从我创建的路径中复制一个log.log文件,在thr文件夹LOg中并将此文件复制到server \ server1 \ logFiles

Can you help me with an exemple?

你可以帮我一个例子吗?

1 个解决方案

#1


0  

Where c:\searchlocation is the path within which you want to search:

其中c:\ searchlocation是您要搜索的路径:

FOR /F "tokens=*" %%F IN ('dir /b /s C:\searchlocation\Text.exe') do (
    copy "%%~pFLog.log" "\server1\logFiles"
)

#1


0  

Where c:\searchlocation is the path within which you want to search:

其中c:\ searchlocation是您要搜索的路径:

FOR /F "tokens=*" %%F IN ('dir /b /s C:\searchlocation\Text.exe') do (
    copy "%%~pFLog.log" "\server1\logFiles"
)