HELP ME!

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Rileyh
Posts: 147
Joined: 01 Sep 2011 03:54
Location: Perth, Western Australia

HELP ME!

#1 Post by Rileyh » 09 Nov 2011 23:07

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
Last edited by Rileyh on 12 Nov 2011 00:17, edited 2 times in total.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: HELP ME!

#2 Post by Ed Dyreen » 10 Nov 2011 00:43

'
Can you narrow the problem please ? :roll:

jeb
Expert
Posts: 1058
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: HELP ME!

#3 Post by jeb » 10 Nov 2011 04:49

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

Post Reply