LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2024, 10:36 PM   #1
DrDwayne
Member
 
Registered: May 2010
Location: Wichita
Distribution: Ubuntu Debian
Posts: 155

Rep: Reputation: 4
Shell out of Windows Program and run Linux program


I can shell out of Windows program running in Wine with the following:
system(WindowsProgram.exe);


But using the same format, I cannot do the following:
(6 different ways i have tried)

system(/usr/bin/ffmpeg);
system(ffmpeg);
system("/usr/bin/ffmpeg");
system("ffmpeg");
system(""ffmpeg"");
system("ffmepg");

Can't recognize '/usr/bin/ffmpeg' as an internal or external command, or batch s
cript.

But, out of the exact terminal window that I
instigate my program .... wine WindowsProgram.exe
I can type in "ffmpeg" and the system recognizes the program.

Any help would be appreciated!

Dwayne
 
Old 03-13-2024, 12:29 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,865
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
In what OS and what programming language?
If it is Windows and C, try this:
Code:
system("WSL ffmpeg");

Last edited by NevemTeve; 03-13-2024 at 12:34 AM.
 
Old 03-13-2024, 01:01 AM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,266
Blog Entries: 24

Rep: Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195
It has been a while since I last used wine, but if I am correctly understanding what you have asked...

Quote:
Originally Posted by DrDwayne View Post
I can shell out of Windows program running in Wine with the following:
system(WindowsProgram.exe);
So you are inside a windows environment as provided by wine, using the windows system() call to invoke another windows program.

Quote:
Originally Posted by DrDwayne View Post
But using the same format, I cannot do the following:
(6 different ways i have tried)

system(/usr/bin/ffmpeg);
system(ffmpeg);
system("/usr/bin/ffmpeg");
system("ffmpeg");
system(""ffmpeg"");
system("ffmepg");

Can't recognize '/usr/bin/ffmpeg' as an internal or external command, or batch s
cript.
Now you are still in the windows environment as provided by wine, still using the windows system() call, but trying to invoke a Linux program on a filesystem not part of the windows environment... unsurprisingly the windows environment complains.

Quote:
Originally Posted by DrDwayne View Post
But, out of the exact terminal window that I
instigate my program .... wine WindowsProgram.exe
I can type in "ffmpeg" and the system recognizes the program.
Now you are in the Linux environment from which you invoke the Linux program wine (which provides the windows environment for the windows program), and from that same Linux environment you are able to invoke a Linux command from the Linux filesystem, as it should be.

I don't see any way to fudge that one.
 
Old 03-13-2024, 01:50 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,856

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
You might find some ideas here: https://stackoverflow.com/questions/...unning-in-wine
 
1 members found this post helpful.
Old 03-13-2024, 03:03 PM   #5
DrDwayne
Member
 
Registered: May 2010
Location: Wichita
Distribution: Ubuntu Debian
Posts: 155

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by astrogeek View Post
It has been a while since I last used wine, but if I am correctly understanding what you have asked...
So you are inside a windows environment as provided by wine, using the windows system() call to invoke another windows program.
Almost...

I am in a linux WINE environment running a windows program. I am attempting to call a linux program ffmpeg from inside the windows program that
is running in wine. Linux comes back and says:

"Can't recognize '/usr/bin/ffmpeg' as an internal or external command, or batch script."


Quote:
Originally Posted by astrogeek View Post
Now you are still in the windows environment as provided by wine, still using the windows system() call, but trying to invoke a Linux program on a filesystem not part of the windows environment... unsurprisingly the windows environment complains.
Above is all true....But I think it is the linux environment that is complaining.



My system call in the Windows Program works perfectly fine calling any kind of Windows program either in Linux or Windows.
but it fails when trying call a linux program.

Thank you
 
Old 03-13-2024, 03:28 PM   #6
DrDwayne
Member
 
Registered: May 2010
Location: Wichita
Distribution: Ubuntu Debian
Posts: 155

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by NevemTeve View Post
In what OS and what programming language?
If it is Windows and C, try this:
Code:
system("WSL ffmpeg");
Tried it. Thanks for the help.

Same Thing:

Can't recognize 'WSL ffmpeg' as an internal or external command, or batch script
.
 
Old 03-13-2024, 03:35 PM   #7
DrDwayne
Member
 
Registered: May 2010
Location: Wichita
Distribution: Ubuntu Debian
Posts: 155

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by pan64 View Post
Thank you very much...That link allowed linux to recognize
the ffmpeg command...It is now just a matter of filling in the
missing pieces.

Dwayne

Edit here is what works....

cmd /c start /unix /usr/bin/ProgramName.

if usr/bin/ is the directory that ProgramName is located at.

Last edited by DrDwayne; 03-16-2024 at 01:30 PM. Reason: added solution..
 
  


Reply

Tags
shell system child



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Material Shell Gets GNOME Shell 40 Support, New Overview And Gtk4 Settings Alternative Tiling GNOME Shell UI LXer Syndicated Linux News 0 05-26-2021 08:33 PM
win32,shell code,shell programming,shell scripting? mr.cracker Linux - Newbie 4 07-12-2013 11:20 PM
What is the current way to shell in/out between Windows XP and Linux? SharpyWarpy Linux - Software 4 11-01-2012 06:27 PM
How to run root privileged Linux command as normal user via shell shell tcegrid Linux - Newbie 1 06-23-2008 03:38 PM
How to run a program in an ssh session that will run after you close out the session? dr_zayus69 Linux - Networking 5 03-05-2006 07:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration