如何从命令提示符中将参数读入程序并进行相应处理? [英] How to read arguments from command prompt into the program and process accordingly?
问题描述
我必须将命令提示符中的参数作为输入读取到程序中,并进行一些密码计算...
I have to read arguments from command prompt into the program as input and do some cryptographic calculations...
例如:
c:/mycipher加密/解密-k 1010101010 -i 10101010 -p file1 -c file2
c:/mycipher encrypt/decrypt -k 1010101010 -i 10101010 -p file1 -c file2
我需要加密/解密" " 1010101010" "10101010&"; "file1" "file2"进入我的程序作为输入.
I need to take "encrypt/decrypt" "1010101010" "10101010" "file1" "file2" into my program as input.
我想知道如何声明一个字符串变量并将参数值传递给它.
i would like to know how to declare a string variable and pass the argument value into it.
如果任何人都可以给我一个小程序,这样我就可以轻松理解它,那就太好了.
It would be great if anyone can just give me a small program so that i can understand it easily.
推荐答案
欢迎来到MSDN论坛.
Welcome to MSDN Forums.
请参考 http://msdn.microsoft.com/zh-cn/library/cb20e19t.aspx (命令行参数(C#编程指南)).
Please refer to http://msdn.microsoft.com/en-us/library/cb20e19t.aspx (Command-Line Arguments (C# Programming Guide)).
您真诚的
Yasser.
这篇关于如何从命令提示符中将参数读入程序并进行相应处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!