1.

Solve : why it is not working??

Answer»

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



thanksQuote
@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?

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).i realy dont know what are you talking about.Quote from: Lwe on March 30, 2011, 08:36:02 AM
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.






Discussion

No Comment Found