passing a string into a command parameter

N

nologo

hello chaps,
how can i pass a string value into a parameter to be called in a batch
script.
i'm building a archive function using 7zip, i wish to be able to
select a location to save which i was going to call in command line as
%1. the problem is getting the location to %1 within c#.

thanks in advance
 
F

Family Tree Mike

Assuming you are using Process.Start, the Process.StartInfo.Filename property
should be cmd.exe, and the Process.StartInfo.Arguments should be the
batchfile and the arguments as a string separated by spaces, quoted as needed.
 
N

Nicholas Paldino [.NET/C# MVP]

nologo,

Well, when you call the Process class, you can pass the program and the
command line to the static Start method, passing the arguments in the second
parameter:

Process process = Process.Start("7zip.exe", "\"c:\Documents and
Settings\Nick\myfile.txt\"");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top