473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

passing arguments to the process C# and ASP.NET

83
Hii all,
im trying to start one process from a webpage and also trying to pass some arguments to that started process..but its not working .here is the code

//CODE

Expand|Select|Wrap|Line Numbers
  1. string inputfile = @"pdfdoc.pdf";
  2.         string outputfile = @"pdfdoc.swf";
  3.  
  4.         Process pdf2swfprocess = new Process();
  5.         pdf2swfprocess.StartInfo.UseShellExecute = false;
  6.         pdf2swfprocess.StartInfo.RedirectStandardOutput = true;
  7.         pdf2swfprocess.StartInfo.CreateNoWindow = true;
  8.         pdf2swfprocess.EnableRaisingEvents = false;
  9.         pdf2swfprocess.StartInfo.WorkingDirectory = @"C:\Documents and Settings\tirumalab\Desktop\PDF2SWF"; 
  10.         pdf2swfprocess.StartInfo.RedirectStandardError = true;
  11.         pdf2swfprocess.StartInfo.FileName = @"C:\Documents and Settings\tirumalab\Desktop\PDF2SWF\pdf2swf.exe";
  12.         pdf2swfprocess.StartInfo.Arguments = inputfile + "-o" + outputfile;
  13.          try
  14.         {
  15.             if (File.Exists(pdf2swfprocess.StartInfo.FileName))
  16.             {
  17.                 pdf2swfprocess.Start();
  18.  
  19.             }
  20.             else
  21.             {
  22.                 Response.Write("The file is not found at tht location ");
  23.             }
  24.             pdf2swfprocess.WaitForExit();
  25.             pdf2swfprocess.Close();
  26.         }
  27.  
Its not throwing any exceptions ..but the file(.swf )is not getting created.

But the same thing is working in command line folderpath>pdf2swf pdfdoc.pdf -o pdfswfdoc.swf.

Plz..help me.
Dec 4 '08 #1
3 7735
btreddy
83
how to pass arguments to the process in C# ?
This is how it is in commandprompt. pdf2swf inputfile.pdf -o outputfile.swf.
pdf2swf is the .exe that i need to start it in a process.
Dec 4 '08 #2
shweta123
692 Expert 512MB
Hi,

Please check that if inputfile and outputfile are present in the working directory path you have mentioned for
pdf2swfprocess.StartInfo.WorkingDirectory.

The process is not starting because may be it is not getting specified arguments in the command prompt.
Dec 4 '08 #3
btreddy
83
Hii thnks for the reply .i solved it.

pdf2swfprocess.StartInfo.Arguments = "pdfdoc.pdf"//inputfile// + "-o" + "pdfswf.swf"//outputfile//;

thn its working.

Thank you.
@shweta123
Dec 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
4
by: Justine | last post by:
Can anyone help? e.g. when you open a vb project property page, in "Configuration Properties" You will see "Command line arguments" in "Start Options". Does anyone knows how to find a way to do...
2
by: pyrexia | last post by:
Greets all. I'm attempting to write an app that will be used as a 'control/launcher' application for other apps. For the sake of argument let's say the app is launched from a command line: ...
2
by: Colmag | last post by:
I'm running a console application (ghostscript) by starting it as a process with arguments. The problem i'm having is that it's falling over when I pass a file containing spaces in the filename...
9
by: Raith | last post by:
Ok I'm still very new to C# and I've been searching around and getting myself all confused so gave up and am posting here. Vastly simplified but I have a form with some tick boxes on it,...
6
by: NYGeekGirl | last post by:
I have two applications, one of which can launch the other using a System.Diagnostics.Process. I want to pass database connection information from one application to the other. I've resorted to...
2
by: william.w.oneill | last post by:
I have an application that takes a few command line parameters. As recommended by others in this group, I'm using a named mutex to ensure that only one instance of the application is running. My...
4
by: cjt22 | last post by:
Hi there. I just wondered whether anyone could recommend the correct way I should be passing command line parameters into my program. I am currently using the following code: def main(argv =...
2
by: PatrickMinnesota | last post by:
I've been reading the docs and looking for an answer and seem stuck. I'm either not looking in the right places or not understanding what I'm reading. I have a bunch of functions. I want to put...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.