Win 7 64 *.bat fail can't even execute echo

Page 1 of 2 12 LastLast

  1. Posts : 5
    Windows 7 64
       #1

    Win 7 64 *.bat fail can't even execute echo


    Context : For my blind father, i wrote a *.bat file that would copy audiobook (mp3 files) from a CD to a memory card. Worked fine on his windows XP computer, when he switched to Windows 7 it worked OK after minors adjustments.

    New Problem : When I got back home, I was informed that the *.bat no longer work.
    After investigations I realise that even REM or ECHO failed to execute (inside the bat file).

    I've search the internet for a solution but couldn't find anything :

    In order to define my problem, I've made a simple bat with just an echo "hello world", ran it inside cmd got the following error :

    Code:
    C:\Users\JP\Documents>test.bat
    
    C:\Users\JP\Documents>■e
    '■e' n'est pas reconnu en tant que commande interne
    ou externe, un programme exécutable ou un fichier de commandes.
    Translated from french it's the well known error message : '■e' not an internal or external command ...

    Since echo work fine as a simple command (in CMD) it does not come from a path error.

    Can you give me a clue about what is wrong on my father's computer ?


    Secondary question :
    With windows XP I used to play sound so my father would know what has to be done next. since sndrec32 was removed from windows 7 does anyone know of an other way to play sound ?
      My Computer


  2. Posts : 934
    Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
       #2

    For first issue, please check path variable. Just type PATH in cmd. Please post result.
    I would scan for malware just in case.

    As for second issue, you can use something like this in your bat file.
    http://superuser.com/questions/101974/play-a-sound-maybe-wav-from-windows-line-command said:
    powershell -c (New-Object Media.SoundPlayer "C:\Windows\Media\notify.wav").PlaySync();
      My Computer


  3. Posts : 521
    Windows 7 Ultimate x64 Service Pack 1
       #3

    May I see the source of your batch file?
      My Computer


  4. Posts : 5
    Windows 7 64
    Thread Starter
       #4

    @Neutron16
    Thank you for taking the time to look into it.
    As stated before I assumed the path was ok since echo worked with CMD and not in the *.bat, on the other hand I have no idea what errors to look for in the path, so here it is
    Code:
    C:\>path
    PATH=c:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;
    C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
    @oreo

    at the moment even at *.bat with just this line is not working
    Code:
    ECHO "hello world"
    My main program is still a work in progress (not very clean, and commented in french)
    Code:
    REM LecteurCD selection du lecteur d'origne des MP3
    set LecteurCD=b
    REM Destination Destination des livres 
    set Destination=g:\$VROtherBooks\
    
    set var="NOK"
    
    
    for /f "tokens=*" %%i in ('dir /b /A:D %LecteurCD%:\') do (
    
    set var="OK"
    
    %LecteurCD%:
    cd %LecteurCD%:/%%i
    
    
    
    if '%%i' equ "mp3" GOTO bad
    if "%%i" equ "Mp3" GOTO bad
    if "%%i" equ "MP3" GOTO bad
    
    set Livre=%%i
    
    echo config livre = %livre%
    goto Copy
    )
    
    if %var% equ "NOK" GOTO bad
    
    
    :eof
    REM Start /min sndrec32 /play /close %SystemRoot%\Media\tada.wav
    Exit 5
    
    :bad
    title entrez titre du livre
    REM Start /min sndrec32 /play /close %SystemRoot%\Media\ringin.wav
    %LecteurCD%:
    set /p Livre= Titre du livre 
    echo titre du livre %Livre%
    goto Copy
    
    :Copy 
    title Copie livre %%i
    echo Copy [%Livre%] To ["%Destination%%Livre%"]
    
    
    REM Start /min sndrec32 /play /close %SystemRoot%\Media\notify.wav
    xcopy /v /y /I *.mp3 "%Destination%%Livre%"
    
    goto eof
    Other informations :
    the batch was working at Xmas, no new program installed but some update were done.
    I haven't confirmed that the errors are the same but some other people using my script (Variables allow me to quickly give it to other users) report suddently not being able to use the script.
      My Computer


  5. Posts : 521
    Windows 7 Ultimate x64 Service Pack 1
       #5

    Well, it's certainly a lot more complicated than I imagined.

    In any case, this output is somewhat strange to me.

    Code:
    C:\Users\JP\Documents>■e
    '■e' n'est pas reconnu en tant que commande interne
    ou externe, un programme exécutable ou un fichier de commandes.
    It seems the command is not properly executed. Here's a crazy idea, can you try this Hello World batch attached to this post?

    I'm trying to figure out if it has anything to do with the encoding of your batch file.
    Win 7 64 *.bat fail can't even execute echo Attached Files
      My Computer


  6. Posts : 5
    Windows 7 64
    Thread Starter
       #6

    @oreo27
    You seem to be on to something since your *.bat file run OK, but when I copy/paste the command into my *.bat file it give me the error message.

    I'm using a simple notepad to do it so I have no idea where the encoding/saving problem come from :/

    As for my main program, it's probably not the most efficient way to do things, but it grew with every case I encounder, in order to make it very simple for the user : this sound mean type the title, this one mean it's copying and the last sound mean copy finished, next book please ^^
      My Computer


  7. Posts : 521
    Windows 7 Ultimate x64 Service Pack 1
       #7

    sc00b said:
    @oreo27
    You seem to be on to something since your *.bat file run OK, but when I copy/paste the command into my *.bat file it give me the error message.

    I'm using a simple notepad to do it so I have no idea where the encoding/saving problem come from :/

    As for my main program, it's probably not the most efficient way to do things, but it grew with every case I encounder, in order to make it very simple for the user : this sound mean type the title, this one mean it's copying and the last sound mean copy finished, next book please ^^
    Well, to be honest, I think it has to do with Windows' language settings. But this is just purely speculation and if someone else can jump in and explain it, that'd be great.

    I personally use Notepad++ Home for coding in batch. The default options work fine for me. Can you try using that and see if you end up with the proper result?
      My Computer


  8. Posts : 5
    Windows 7 64
    Thread Starter
       #8

    OK seems to be working. Thank you very much Oreo27 for the quick response, now I just need to add the sound (thanks Neutron16).

    I will post the *.bat once it's completed if you recon it might help someone, someday.
      My Computer


  9. Posts : 521
    Windows 7 Ultimate x64 Service Pack 1
       #9

    sc00b said:
    OK seems to be working. Thank you very much Oreo27 for the quick response, now I just need to add the sound (thanks Neutron16).

    I will post the *.bat once it's completed if you recon it might help someone, someday.
    No worries. Glad it works. :)
      My Computer


  10. Posts : 934
    Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
       #10

    oreo27 said:
    if someone else can jump in and explain it, that'd be great
    I was able to recreate the error. That happens when you save your bat file in notepad in UTF-8 encoding instead ANSI. You need to save it again in ANSI.

    Notepad would ask for encoding change if it finds that file contains any letters with accents for example (é, è, ê etc.).
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:57.
Find Us