我将下面的命令作为Windows批处理文件存储在其中,并且只需一个参数即可正常运行。
start /d "C:\TestRunner\bin\Release" Runner.exe "99F46289-3B9D-4D21-AE53-E8AD9F502BE2"
我想向它发送一个类似于以下字符串的数组
//args = new[] { "99F46289-3B9D-4D21-AE53-E8AD9F502BE2", "1" };
我如何格式化命令以使其在字符串数组上方运行?
答案 0 :(得分:0)
数组无非是一种通过索引分隔内存的方法,而cmd.exe只需一点创意就可以做到。您实际上应该在这里进一步说明您要做什么。这是从cmd.exe
进行数组处理的方法def signup(request):
if request.method == 'POST':
company_form = CompanyForm(request.POST, prefix='company')
user_form = SignUpForm(request.POST, prefix='user')
if company_form.is_valid() and user_form.is_valid():
company_form.instance.name = company_form.cleaned_data['name']
company_form.instance.domain_url = company_form.cleaned_data['name'] + '.localhost'
company_form.instance.schema_name = company_form.cleaned_data['name']
company = company_form.save()
user_form.instance.company = company
user = user_form.save()
auth_login(request, user)
return HttpResponseRedirect(reverse('post:post_list'))
else:
company_form = CompanyForm(prefix='company')
user_form = SignUpForm(prefix='user')
args = {}
args.update(csrf(request))
args['company_form'] = company_form
args['user_form'] = user_form
return render(request, 'accounts/signup.html', args)
答案 1 :(得分:0)
我认为您可以修改exe文件,这是一个示例。 C#程序:
static void Main(string[] args)
{
foreach (string arg in args)
Console.WriteLine("Argument: " + arg);
Console.WriteLine("End");
Console.ReadLine();
}
启动命令:
start ConsoleApp3.exe par01 par02 par03 par04
输出:
Argument: par01
Argument: par02
Argument: par03
Argument: par04
End