Page 1 of 1

HELP ME!

Posted: 09 Nov 2011 23:07
by Rileyh
Hi,
Whenever I run this I click and drag to an open cmd window and then I run it and it says ": was unexpected at this time".
Why?
Here is my code (my longest yet):

Code: Select all

@echo off
title ProDOS Studio Beta
set "`="
setx dynamicvariable %`%
:start
set /p b= Program to run- (directory:\filepath\file.fileextension) 
cls
setlocal disableDelayedExpansion
set "file=%b%"
set "search=listschedtasks /newtask /userinput=1 "
for /f "delims=" %%A in ('findstr /i /c "%search%" "%file%"') do (
  set "ln=%%A"
  set /p k=Enter time to run program:
  set /p l=Do you want a reccuring date? (enter lowercase y/n):
  if /i _"%l%"==_"y" (goto recurdate)
  at %k% "!ln:*%search%=!"
  :recurdate
  set /p m=Enter a recurring date:
  at %k% %m% !ln:*%search%=!
  setlocal enableextensions
  break
  endlocal)
  if %errorlevel%==1 (goto c)
  goto :eof
 


What happens is when I run it is supposed to look for the text string listschedtasks /newtask /userinput=1 and execute the code that occurs in the "do" section of the "for" string. But for me it says "findstr- /c ignored" "findstr- cannot open %b%" "invalid command".
And then it continues with the program from :recurdate and then comes up with the error "endlocal)" is not recognised as a internal or external command or batch file."

Could you at least attempt to explain this?
Regards,
Rileyh

Re: HELP ME!

Posted: 10 Nov 2011 00:43
by Ed Dyreen
'
Can you narrow the problem please ? :roll:

Re: HELP ME!

Posted: 10 Nov 2011 04:49
by jeb
Hi Riley,

if I start it from the console there doesn't occur any error :!:

As Ed suggested, reduce your code to a minimum, so the the error still occurs and describe what you do to reproduce the problem.

jeb