Reputation: 27
I have been trying to find a solution to this problem. My batch file works fine on the desktop but does not work in program file folder. I have taken ownership of the folder in case that was the issue but did not fix it.
I run the following script but returns "Files was unexpected at this time." at the FOR line.
:SearchSame
set location=%cd%
goto Search
:Search
setlocal EnableDelayedExpansion
cls
echo.
Echo. Searching for .exe files in %location% and its subfolders
echo.
set /a count=0
echo.___________________________________________
echo.Found:
echo.
FOR /R %location% %%i in (*.exe) do (set /a count+=1 & IF !count! lSS 10 "(echo. !count!. %%~ni)" else "(echo. !count!.%%~ni)")
echo.___________________________________________
echo.
IF %count% EQU 0 (
title Exe blocker - No Files Found! & cls & echo. & echo. Exe Blocker was unable to find any files with .exe extention in the folder & echo. location of %location% or subfolders. & echo. & echo. Please check the folder and search again & echo. & Pause & goto Start
) ELSE (
title Exe blocker - Showing %count% Exe Files ) & echo. Number of files found with .exe extention: %count%
)
echo.
echo.
I have added "" around the echo. counts in the FOR loop but that didn't fix the issue.
I am running windows 10 - it worked fine on windows 8.1.
Cheers for your help!
Upvotes: 0
Views: 183