如何关闭批处理显示的文件路径?

huangapple go评论86阅读模式
英文:

How do I turn off the filepath that batch displays?

问题

你好,我理解你的要求。以下是翻译好的部分:

你好,我目前正在进行一个Python项目,在其中使用批处理。

我的问题是,每当我的脚本运行批处理文件时,它总是显示出文件中的命令及其路径。

以下是一个示例:

Python 代码:

import subprocess

subprocess.call("test.bat")

批处理代码:

echo Hello World

输出:

C:\Users\[用户]\OneDrive\Desktop\Python>echo Hello World 

Hello World
英文:

Hello I'm currently working on a python project where I use batch.

My problem now is anytime my script runs a batch files it always shows me the path with the command that is in the file.

Here is an example:

python:

import subprocess

subprocess.call("test.bat")

batch:

echo Hello World

output:

C:\Users\[user]\OneDrive\Desktop\Python>echo Hello World 

Hello World 

答案1

得分: 1

尝试在批处理脚本的顶部添加 @echo off 以关闭打印命令(包括路径)。

英文:

Try adding @echo off to the top of your batch script to turn off printing of commands (including the path).

huangapple
  • 本文由 发表于 2023年6月6日 06:15:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76410317.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定