Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: why it is not working?  (Read 3988 times)

0 Members and 1 Guest are viewing this topic.

Lwe

    Topic Starter


    Rookie

    why it is not working?
    « on: March 29, 2011, 03:55:25 PM »
    i have this script:

    Quote
    @echo off

    if (%1)==(0) goto skipme
    echo -------------------------------------------------------------------------- >>logerror.txt 
    echo ^|%date% -- %time%^|            >>logerror.txt
    echo -------------------------------------------------------------------------- >>logerror.txt
    script 0 2>> logerror.txt
    :skipme

    set workingfolder=C:\Users\Lior\Hero\ROMS\Myn\Rom Manager
    color f0

    :menu
     cd %workingfolder%
     cls
     echo.
     echo.
     echo ---------------
     echo Usual Procedure
     echo ---------------
     echo 0    Start clean
     echo 1    Extract rom
     echo 2    Add hebrew Fonts.
     echo 3    Remove unwanted apps.
     echo 4    Edit prop.
     echo 5    Add ringtone.
     echo 6    Delete unwanted media.
     echo 7    zip and sign.
     echo 8    Do all.
     echo --------------------------------------------------------------------------
     echo.
     set /p choice=
     if %choice%==0 (goto clean)
     if %choice%==1 (goto extract)
     if %choice%==2 (goto hebrew)
     if %choice%==3 (goto apps)
     if %choice%==4 (goto prop)
     if %choice%==5 (goto ringtone)
     if %choice%==6 (goto media)
     if %choice%==7 (goto zip)
     if %choice%==8 (goto all)
     goto menu
     

    :clean
     cd rom
     rmdir /s /q extractedRom\
     md extractedRom
     goto menu

    :extract
     cd tools
     echo extracting...
     7za x -o"../rom/extractedRom" "../rom/*.zip" 1>>nul
     goto menu

    :hebrew
     cd rom/extractedRom/system
     rmdir /s /q fonts\
     md fonts
     cd C:\Users\Lior\Hero\ROMS\Myn\Tools
     xcopy /y /s fonts "c:/users/lior/hero/roms/myn/Rom Manager/rom/extractedRom/system/fonts"
     goto menu

    :apps
     cd rom/extractedRom/system/app
     del com.htc.StockWidget.apk
     del com.htc.TwitterWidget.apk
     del com.htc.WeatherWidget.apk
     del Flickr.apk
     del htcbookmarkwidget.apk
     del HtcTwitter.apk
     del Maps.apk
     del Stk.apk
     del teeter.apk
     goto menu

    :prop
     cd rom/extractedRom/system
     build.prop
     goto menu

    :zip
     msg * gsd
     cd tools
     7za a  -tzip "C:\Users\Lior\Hero\ROMS\Myn\Rom Manager\rom\zippedrom" "C:\Users\Lior\Hero\ROMS\Myn\Rom Manager\rom\extractedRom\*"
     cd sign
     call sign
     goto menu



    at the beginning, the lines that suppose to show time and date and --------- does not work, with no errors.
    even if i add line like
    echo ----------------------------

    in the  :menu



    thanks

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: why it is not working?
    « Reply #1 on: March 30, 2011, 05:15:59 AM »
    Quote
    @echo off

    if (%1)==(0) goto skipme
    echo -------------------------------------------------------------------------- >>logerror.txt
    echo ^|%date% -- %time%^|            >>logerror.txt
    echo -------------------------------------------------------------------------- >>logerror.txt
    script 0 2>> logerror.txt
    :skipme

    Quote
    at the beginning, the lines that suppose to show time and date and --------- does not work, with no errors

    This thread looks very familiar. Feel like I got on a merry-go-round on Groundhog Day and can't get off.

    Actually, the lines at the beginning are NOT coded to show you the date and time as you are redirecting the echo output to a file. In fact, the echo statements work exactly as you coded them. If you want the date and time displayed on the console, lose the redirection. If you want both redirection and console output you'll need to code both outputs. I already posted in your other thread that you cannot send the same output to two different streams in the same instruction.

    Just guessing, but is your batch file named script? If so the reference to script in the file is a recursive transfer of control back to the running file. Not only can this create problems, it is not best practice. What are you trying to do? Your file has a check for the first command line parameter which skips over the redirection. Why?

    How did you manage to turn something so simple into a Rube Goldberg contraption?

     8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    Lwe

      Topic Starter


      Rookie

      Re: why it is not working?
      « Reply #2 on: March 30, 2011, 08:36:02 AM »
      I know what you said, but i asked the creator of the script that we were talking about and he told me to add this lines.
      and it worked.
      in addition, this function redirected the echo time and date to the log file and also to the console.
      but now it is not working(echo time and date).

      Lwe

        Topic Starter


        Rookie

        Re: why it is not working?
        « Reply #3 on: March 30, 2011, 09:40:49 AM »
        i realy dont know what are you talking about.

        Sidewinder



          Guru

          Thanked: 139
        • Experience: Familiar
        • OS: Windows 10
        Re: why it is not working?
        « Reply #4 on: March 30, 2011, 01:04:14 PM »
        but now it is not working(echo time and date).

        The error message is : 'script' is not recognized as an internal or external command,
        operable program or batch file
        .

        How do you know it doesn't work?  It never runs. Use a fully qualified path to script and use the call instruction if script is a batch file.

        If you had explained from the beginning what script is and what it does, you wouldn't have needed two threads and countless posts for a simple question. <sigh>

         8)


        The true sign of intelligence is not knowledge but imagination.

        -- Albert Einstein