I am trying to create windows batch script to check the size of file after it is downloaded but it fails with this message. The Process cannot access the file as it is used by another process 2048 was unexpected at this time. Thanks in advance for any help.
Code -
@echo off
d:\wget.exe ...
Rem this wget process downloads tst_file.xml
set file="tst_file.xml"
set maxbytesize=2048
for /F "usebackq" %%A IN ('%file%') DO set size=%%~zA
if %size% LSS %maxbytesize% (echo file is less than 2KB)
Process cannot access the file as it is used by another process
Moderator: DosItHelp
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Process cannot access the file as it is used by another process
As was mentioned in https://stackoverflow.com/questions/705 ... er-process, it sounds like tst_file.xml is still open somewhere because every other line in the script that you posted works correctly, so there's some issue with the wget command trying to write to a file that's in use.