【问题标题】:How to pass a string as an argument to a batch file如何将字符串作为参数传递给批处理文件
【发布时间】:2013-09-17 05:31:58
【问题描述】:

我想缩短,

 net send abc123 "Message to my dear friends and family"

 Laurie "Message to Laurie"

其中“Laurie”是一个批处理文件 Laurie.bat,包含空格、逗号等的消息将传递到该文件。如何将字符串作为参数传递给批处理文件?

【问题讨论】:

  • 我知道传递数据的唯一安全方法是通过管道。最早的MSG 命令支持它,但NET SEND 不支持。您总是会遇到逗号问题,特别是 。你准备好使用第三方应用了吗?
  • @LS_dev - 我们已经是,但有些人一直拒绝使用它。所以我想为这些“开发”一系列类似的 bat 文件。
  • 你没有发表评论 - 我的建议是不可接受的吗?

标签: batch-file windows-xp


【解决方案1】:

你可以把它缩短成这个,你是这个意思吗?

Laurie "Message to my dear friends and family"

使用这个:

:: laurie.bat
@echo off
net send abc123 "%~1"

【讨论】:

    猜你喜欢
    • 2023-03-29
    • 2013-03-22
    • 2010-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-28
    相关资源
    最近更新 更多