У нас вы можете посмотреть бесплатно Fixing the "ECHO is on" Issue in Batch Scripts или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Learn how to resolve the "ECHO is on" problem in your batch scripts and get the actual variable values you need. This guide provides easy-to-follow solutions and explanations. --- This video is based on the question https://stackoverflow.com/q/65346292/ asked by the user 'missx' ( https://stackoverflow.com/u/10053262/ ) and on the answer https://stackoverflow.com/a/65347151/ provided by the user 'Stephan' ( https://stackoverflow.com/u/2152082/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions. Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Why I receive "ECHO is on" instead of variable value? Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l... The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license. If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com. --- Why Am I Seeing "ECHO is on" Instead of My Variable Value? If you've ever encountered the frustrating message "ECHO is on" when running a batch script in Windows, you are not alone. Many users experience this issue when trying to capture the output of a command into a variable. This guide explains why this happens and how to fix it step-by-step. The Problem: Understanding "ECHO is on" When you run a batch script, it often uses the ECHO command to display values. If the variable you're trying to access is empty or undefined, you'll see the default message “ECHO is on.” In your case, it looks like the batch script you're working with runs another script, test.bat, which is meant to return the CPU temperature, but you find that the variable RESULT is empty. Why is the Variable Empty? Upon deeper inspection, the problem stems from how the FOR loop processes the output of the test.bat script. Specifically, it's likely that test.bat is returning a blank line, or perhaps there are extra characters in the output that affect variable assignment. This can happen if there are unintended newlines or formatting issues in the output. The Solution: Capturing the Output Correctly To solve the problem of getting "ECHO is on," you can modify your script to filter out empty lines from the output of your command. Here's how you can do it effectively: Step-by-Step Fix Modify the FOR Loop: Use the findstr command to filter out any empty lines in the output. Here’s the corrected script: [[See Video to Reveal this Text or Code Snippet]] How It Works: The FOR /F command reads the output of test.bat and processes it line by line. The findstr "." filters the output, ensuring that only non-empty lines are passed to the FOR loop. SET RESULT=%%a assigns the last non-empty line produced by test.bat to the variable RESULT. Important Note This method captures only the last line of output from test.bat. If your command returns multiple values (like two temperatures), only the last value will be stored in RESULT. Be sure to keep this in mind when working with commands that return multiple lines or values. Conclusion By implementing the above adjustments to your batch script, you can effectively eliminate the confusing "ECHO is on" message and ensure that your variables hold the values you expect. Filtering out unnecessary output with findstr can greatly enhance your script’s efficiency and functionality. Now you have a clear understanding of both the problem and the solution for getting variable values in your batch scripts. Happy scripting!