473,398 Members | 2,812 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,398 software developers and data experts.

Shell problems

1
Hi!

I had no expereince in coding a few months ago, and i didn't see the point either, thought it'd be rubbish! then when i had to study it for my collage course this year my god i took a liking to it, it passes the time and allows me to make stuff that are helpful for me and maybe others =)

Anyways i figured i'd sign up to a forum so i can read post and find ideas for some projects, and i'm current stuck on one of my projects at the moment =)

If i use the command in dos:

Expand|Select|Wrap|Line Numbers
  1. c:\program files\winrar\winrar.exe e "ffmpeg.7z" bin\ffmpeg.exe
This will extract the file ffmpeg.exe located in the bin folder of the rar archive, works perfectly... then i tried to implement that into my project with this

you should note i have the file being downloaded using webclient

Expand|Select|Wrap|Line Numbers
  1. webClient.DownloadFileAsync(new Uri("http://ffmpeg.arrozcru.org/autobuilds/ffmpeg-latest-mingw32-static.7z"), "ffmpeg.7z");
this downloads the file directly to the built exe for the project

Expand|Select|Wrap|Line Numbers
  1. if (File.Exists("C://Program Files//WinRAR//WinRAR.exe"))
  2.              {
  3.                  winrar = "C://Program Files//WinRAR//WinRAR.exe";
  4.                  proc.EnableRaisingEvents = false;
  5.                  proc.StartInfo.FileName = winrar;
  6.                  proc.StartInfo.Arguments = "e ffmpeg.7z bin//ffmpeg.exe";
  7.                  proc.Start();
  8.                  label4.Text = "Extracting";
  9.                  proc.WaitForExit();
  10.                  label4.Text = null;
  11.                  label3.Text = "FFMPEG Updated";
  12.              }
  13.         else
  14.              {
  15.                  MessageBox.Show("Winrar is either not installed or installed to a diffrent location... Please find it for me!"); 
  16.                  openwin.Filter = "|winrar.exe";
  17.                  openwin.ShowDialog();
  18.                  proc.EnableRaisingEvents = false;
  19.                  proc.StartInfo.FileName = openwin.FileName;
  20.                  proc.StartInfo.Arguments = "e ffmpeg.7z bin//ffmpeg.exe";
  21.                  proc.Start();
  22.                  label4.Text = "Extracting";
  23.                  proc.WaitForExit();
  24.                  label4.Text = null;
  25.                  label3.Text = "FFMPEG Updated";
  26.             }
  27.  
Now in my eyes that should work, i can't see a fault yet it still does nothing, any ideas?!

The project i'm making is a simple FFMPEG converter from whatever to an flv, i have a problem with that also =)

Expand|Select|Wrap|Line Numbers
  1.  
  2.         private void button4_Click(object sender, EventArgs e)
  3.         {
  4.             // converting ends prematurly
  5.             // maybe add "no file input / output"
  6.             // ****ing **** crap
  7.             try
  8.             {
  9.                 proc.EnableRaisingEvents = false;
  10.                 proc.StartInfo.FileName = "ffmpeg.exe";
  11.                 proc.StartInfo.Arguments = "-y -i " + open.FileName + " -acodec libmp3lame -ar 22050 -f flv " + save.FileName;
  12.                 proc.Start();
  13.             }
  14.             catch
  15.             {
  16.                 MessageBox.Show("There was an error converting that file!");
  17.             }
  18.         }
  19.  
Problem here is the conversion starts in a separate window, not too sure if i care about that though, but it ends a few seconds in with no errors or anything, as if system.diagnostics is set to end the process if nothing happens after x amount of seconds

Thanks in advance guys!
Apr 4 '10 #1
1 1992
Plater
7,872 Expert 4TB
It is only the \ that has to be escaped by making it \\
Using the / you would only need a single \. Althought I am not sure if windows chokes on using different slash formats.
Have you tried setting a breakpoint and stepping through it?

You're also using "relative" pathnames for the output. It might not be extracting the files where you think.
For texting purposes try something like: "e ffmpeg.7z c:\\bin\\ffmpeg.exe";
(or some other absolute pathname)

EDIT:
For your second part: Yes it will open in a "seperate window". You're running a seperate process. If you really wanted to, you can redirect the standard IO (in/out/error) to your project and examine the output/etc to see what the program is saying.
You can also tell it to NOT draw the dos-box-y window when running the process
Apr 5 '10 #2

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

Similar topics

8
by: zhiwei wang | last post by:
I remember that there is a function that could invoke shell command such as "rm" "cp", directly in .c file. But I could not recall its name, and I googled with nothing meaningful. I vaguely...
2
by: Sin | last post by:
Hello everyone, I'm totally stumped at how little info I can find in MSDN or on the web concerning this. It's almost as if only microsoft personel hold the key to these secrets or something!!! ...
3
by: moondaddy | last post by:
I need to start an ms access 2003 app from a vb.net winforms app and didn't want to load all the interop stuff for office into the .net project. I thought that using the shell cmd would be a nice...
0
by: paulhjwu | last post by:
Hi, I have problems running a couple of shell scripts from PHP. I found a similar posting, so I posted my question to the original author. But unfortunately the original author is not at the...
4
by: emin.shopper | last post by:
Emacs seems to freeze when doing certain shell commands on Microsoft Windows. The following is a simple example with Xemacs: ---------------------------------------------------------- ...
7
by: Bin Chen | last post by:
Hi, I want to do following: get a user input regex, then pass this as a parameter to grep, and then get the result from grep. Any code snip to implement the similar function? I am a python...
7
by: Frank Potter | last post by:
I learned some python in windows. And now I've turned to linux. I read a book and it teaches how to write shell script with bash, but I don't feel like the grammar of bash. Since I know about...
5
by: inetquestion | last post by:
I am looking for a web interface for shell commands or shell scripts. Does anyone know of any exexisting php scripts which would solve this requirement? PHP form accepts input from a user, then...
14
by: xander.grespesky | last post by:
hi all, I'm looking for recommendations for unix "shell access" services that provide a c++ compiler (gcc or intel). free would be preferable. basically i'm looking at testing out some...
0
by: eerpini | last post by:
On Mon, 2008-11-17 at 01:56 -0800, James Kanze wrote: he was not referring to shell access using the system() call so that he could run shell commands. He was rather looking for a shell access...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.