MCPcopy Create free account
hub / github.com/conda/constructor / bat_echo_esc

Function bat_echo_esc

constructor/utils.py:417–427  ·  view source on GitHub ↗

Escape a string for use in a Windows batch file ECHO command. Escapes special shell characters that would otherwise be interpreted as redirections or command separators.

(s: str)

Source from the content-addressed store, hash-verified

415
416
417def bat_echo_esc(s: str) -> str:
418 """Escape a string for use in a Windows batch file ECHO command.
419
420 Escapes special shell characters that would otherwise be interpreted
421 as redirections or command separators.
422 """
423 # ^ must be escaped first since it's the escape character
424 s = s.replace("^", "^^")
425 for c in ("&", "<", ">", "|"):
426 s = s.replace(c, f"^{c}")
427 return s
428
429
430def check_required_env_vars(env_vars):

Callers 2

test_bat_echo_escFunction · 0.90
render_templatesMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_bat_echo_escFunction · 0.72