Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

04 Mar 2013   #11
oreo27

Windows 7 Ultimate x64 Service Pack 1
 
 

Quote   Quote: Originally Posted by Neutron16 View Post
Quote   Quote: Originally Posted by oreo27 View Post
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.).
That's strange. The default encoding for Notepad++ is UTF-8 without BOM. Yet, if I save the batch file, it still works okay.

But, If I change it to UTF-8, I'm also able to reproduce the error.

Code:
C:\Users\Rokn\Documents>@ECHO Test
'@ECHO' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
I never did understand these options. Lol.

I only learned about these because some batch files (.txt files, actually) were not running properly in game The Elder Scrolls V: Skyrim - Wikipedia, the free encyclopedia.

Just a bit of an edit:

From my understanding, I think that UTF-8 adds some hidden characters that identify it as such in terms of encoding. These characters are passed on to the batch file which break the first command. Other commands should still function. Notepad++'s option of removing the BOM fixes the problem.

The source can be found here - http://stackoverflow.com/questions/2...-8-without-bom


My System SpecsSystem Spec
.
07 Mar 2013   #12
sc00b

Windows 7 64
 
 

At last I've finished my script :

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
powershell -c (New-Object Media.SoundPlayer "%SystemRoot%\Media\'Windows shutdown.wav'").PlaySync();
Exit 5

:bad
title entrez titre du livre
REM Start /min sndrec32 /play /close %SystemRoot%\Media\ringin.wav
powershell -c (New-Object Media.SoundPlayer "%SystemRoot%\Media\'Windows print complete.wav'").PlaySync();
%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
powershell -c (New-Object Media.SoundPlayer "%SystemRoot%\Media\'Windows balloon.wav'").PlaySync();

xcopy /v /y /I *.mp3 "%Destination%%Livre%"

goto eof
Notes :
I was not able to play sound from %SystemRoot%\Media\Sonata\* because it seems it wasn't a "PCM Sound"

Is it possible to declare powershell object at he begining of the script and use it later on to play the sound ? Because now the script run well enough, but the sound playing cause a 2-3 second lag...

Once again thank you very much for the help... Futur modification will wait for my next visit home
My System SpecsSystem Spec
Reply

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




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Echo-y sound
On my new Windows 7 tower computer, when I plug in speakers or headphones, everything sounds like the bottom of a well. How can I get rid of that? (Realtek High Definition Audio) (Windows Home Premium SP 1) Thanks,
Sound & Audio
Sound has a little echo
My sound in Windows 7, windows media player, has a little echo. It's like my speakers are at the bottom of a well. Any idea on how to make the sound normal? I have the newest drivers installed. Thanks
Sound & Audio
echo
when i listen to music or watch a movie, then the sound just echos... is the problem in my headphone because speakers are working fine..?
Sound & Audio
Microphone with echo
Well guys, i use microphone to play, but when people talk something in TS/Ventrilo(voice comunication programs) people can her themselves cause my microphone is with echo. But this doesn't happen when i use windows xp with the same phone, does any1 know why?
Sound & Audio
ECHO echo sounds
Hi My only poroblem with RC7100 revolves around the fact that through my speakers, when playing music, I get an "echo-ey" sound....I thought it was because I had placed my microphone too close to the speakers and/or had my microphone turned up too loud (no such problem when set up the same when...
Sound & Audio


Our Sites

Site Links

About Us

Find 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 22:12.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App