简体   繁体   English

有关如何将字符串从Excel工作表传递到命令行工具的建议

[英]Advice on how to pass strings from an excel sheet into a command line tool

So I have this crazy idea to pass strings from an excel sheet into a command line tool, for a data integrity test. 因此,我有一个疯狂的想法,将字符串从excel工作表传递到命令行工具,以进行数据完整性测试。

Say I have a sheet set up as so: 假设我这样设置了工作表:

  A        B        C        D         E
1 ID       First    Last     Position  IP

2 312      George   Foreman  CEO       999.22.3.1

3 443      Billy    Mays     Mailroom  999.12.5.2

4 243      Sugar    Ray      CFO       999.55.2.1
...
n 999      Betty    Crocker  Boss      999.21.0.1

Where the parameter I'd like to pass into my command line tool is E (IP). 我想传递给命令行工具的参数是E(IP)。

I'd like to pass in my parameters in this form: 我想以这种形式传递参数:

C:\User> Program.cmd IP

eg 例如

C:\User> Program.cmd 999.55.2.1

What would be the best way to approach this problem? 解决这个问题的最佳方法是什么? I've been trying to write a batch script, but I'm having trouble extracting the string I want. 我一直在尝试编写批处理脚本,但是在提取所需的字符串时遇到了麻烦。 Should I just suck it up and do this in C# or Java, or is there a different way (I'm very curious because I can't seem to find a paradigm for this, and I'd really like to learn more about batch). 我应该用C#还是Java来做,还是用另一种方式(我很好奇,因为我似乎找不到这种范例,我真的很想了解有关批处理的更多信息)。

Thank you! 谢谢!

I see no reason why you can't write a macro that uses shell to call the exe. 我看不出没有任何理由不能编写使用Shell调用exe的宏。 see http://dmcritchie.mvps.org/excel/shell.htm 看到http://dmcritchie.mvps.org/excel/shell.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM