Cant get SET command working correctly, anyone help?
Posted: February 6th, 2010, 1:18 pm
hi all, i'm trying to create a script to rename the post processed folder to the largest file thats inside it. However i'm having some troubles with the SET command:
if you run this script as a .cmd file from windows explorer it finds the largest file and strips the extension from it, which is contained in %largestfile% example: myfile.ext becomes myfile
however if sabnzbd runs it, the largestfile variable is always empty!
anyone tell me whats going wrong?
Code: Select all
for /f "tokens=*" %%f in ('dir /os /b') do if %%f NEQ "" (
set largestfile=%%f
echo "lf = %largestfile%"
)
echo %largestfile%
set largestfile=%largestfile:~0,-4%
however if sabnzbd runs it, the largestfile variable is always empty!
anyone tell me whats going wrong?