Announcement

Collapse
No announcement yet.

blackberry script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • blackberry script

    Hey guys,

    I'm having some trouble with this batch script I'm trying to write for the "pending.exe" tool that comes bundled with BES resource kit tools. I believe I have almost everything right...but I just need a little help.

    What should be happening is this:
    • set folder paths
    • check if they exist
    • browse to log file directory
    • find the most recent logfiles folder
    • if an argument was specified for a users email, use that in the pending.exe's syntax. If not specified, goto the all menu


    What happening, is it doesn't seem to be listening to my if/else statement

    Anyone help?

    Code:
    @echo off & SETLOCAL & Title Pending Messages
    
    :: set folder paths
    SET "sCurrentDir=%CD%"
    SET "sLogFiles=C:\Program Files (x86)\Research In Motion\BlackBerry Enterprise Server\Logs"
    SET "sPath=C:\Program Files (x86)\Research In Motion\BlackBerry Enterprise Server Resource Kit\BlackBerry AMT Tools"
    
    :: check folder paths
    IF NOT exist "%sPath%" goto :ERROR_Path
    IF NOT exist "%sLogFiles%" goto :ERROR_LogFiles
    
    cd %sLogFiles%
    
    :: find most recent folder
    FOR /f "delims=" %%a in ('dir/b/od') DO (SET sRecent="%sLogFiles%\%%a")
     cd %sPath%
    
    IF NOT ("%1" == "") DO (
      SET sEmail=%1
      pending.exe -p E -u %sEmail% -L %sRecent% -OL "%sCurrentDir%"
    ) ELSE (
      GOTO :ALL)
    
    :ALL
    pending.exe -p E -u all -L %sRecent% -OL "%sCurrentDir%"
    
    :ERROR_Path
       echo There was an error in the sPath variable...
    goto:eof
    
    :ERROR_LogFiles
       echo There was an error in the sLogFiles variable...
    goto:eof
    Last edited by ekrengel; 1st April 2010, 18:48.

  • #2
    Re: blackberry script

    Ok I got it working

    I don't know why it had to be this way or if there's another way, but here it is:

    Code:
    IF "%1" == "" (
    pending.exe -p E -u all -L %sRecent% -OL "%sCurrentDir%"
    goto:eof
    ) ELSE (
      GOTO :EMAIL
    )
    
    :EMAIL
    SET sEmail=%1
    pending.exe -p E -u %sEmail% -L %sRecent% -OL "%sCurrentDir%"
    goto:eof
    I was reading if you had the parentheses not setup correctly, then is messes everything up. I also don't know if the "IF NOT" or "DO" had anything to do with it.
    Last edited by ekrengel; 1st April 2010, 18:48.

    Comment

    Working...
    X