Computer Hope

Microsoft => Microsoft Windows => Windows Server => Topic started by: alvaramya on June 05, 2010, 12:20:49 AM

Title: need help -dos script
Post by: alvaramya on June 05, 2010, 12:20:49 AM
To check the file is 0 kb in particular directory
if the file is 0 kb display it and call the corresponding script to re-run it
if the file is not  0  kb then exit
   
Title: Re: need help -dos script
Post by: Salmon Trout on June 05, 2010, 01:31:46 AM
Code: [Select]
set filename=somefilename.ext
set folder=d:\path\folder
set script=d:\path\script.cmd
for /f "delims=" %%A in ("%folder%\%filename%") do set filesize=%%~zA
if %filesize% NEQ 0 call "%script%"
Title: Re: need help -dos script
Post by: Salmon Trout on June 05, 2010, 03:47:18 AM
Correction

Code: [Select]
set filename=somefilename
set folder=d:\path\somefolder
set script=d:\path\somescript
for /f "delims=" %%A in ("%folder%\%filename%") do set filesize=%%~zA
if %filesize% EQU 0 (
    echo %filename% 0 bytes
    call "%script%"
    )