Cant get SET command working correctly, anyone help?

Come up with a useful post-processing script? Share it here!
Post Reply
igw202
Newbie
Newbie
Posts: 1
Joined: February 6th, 2010, 1:11 pm

Cant get SET command working correctly, anyone help?

Post by igw202 »

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:

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%
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?
Post Reply