Executing bat file in Wine from bash shell

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Rezmason
Newbie
Newbie
Posts: 3
Joined: Thu Jun 24, 2010 9:45 am

Executing bat file in Wine from bash shell

Post by Rezmason »

I run OS X, and I want to execute a bat file in Wine from within a shell script. Is there a way to do this? Can Wine accept a path to an executable/bat file as an argument?

And can this be done without having to open and close Wine each time the build process is initiated? I'd like to use a currently running Wine instance, if there is one.
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Post by doh123 »

have you tried...

wine cmd batchfile.bat

I'm not sure why you'd want to run a batch file, there has to be an easier way to do what you want.
Rezmason
Newbie
Newbie
Posts: 3
Joined: Thu Jun 24, 2010 9:45 am

Post by Rezmason »

doh123 wrote:I'm not sure why you'd want to run a batch file, there has to be an easier way to do what you want.
Fine by me, I haven't even written the bat file yet. But I wasn't sure if there was a way to do it without the bat file.

The bat file would pass some arguments to a CUI tool. Ideally I'd like to do this somehow:

Code: Select all

wine cmd -executable=./path/to.exe -args="$arg1 $arg2"
[/code]
Rezmason
Newbie
Newbie
Posts: 3
Joined: Thu Jun 24, 2010 9:45 am

Post by Rezmason »

Wait, I suppose I don't technically need to run cmd! Just as long as there's some way to pass arguments to an exe from the command line:

Code: Select all

wine ./path/to.exe -args="$arg1 $arg2"
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Post by doh123 »

Rezmason wrote:Wait, I suppose I don't technically need to run cmd! Just as long as there's some way to pass arguments to an exe from the command line:

Code: Select all

wine ./path/to.exe -args="$arg1 $arg2"
you can pass args along just fine...

usually you want to cd into the folder, many programs like you running them from in the folder not just giving the path to them... but most current programs will work either way.

how to pass command line arguments... here is an example using Wine's notepad

wine notepad textfile.txt

will open notepad and pass it the argument to make a new text file called textfile.txt...

as long as the exe knows how to handle the arguments you just stick them on there, no special flags or anything needed.
sieira
Newbie
Newbie
Posts: 1
Joined: Mon Dec 05, 2011 5:37 pm

Post by sieira »

This thread seems to be very old, most of the bat files should be runnable using

Code: Select all

wine cmd < path/to/your/file.bat
.
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Post by doh123 »

sieira wrote:This thread seems to be very old, most of the bat files should be runnable using

Code: Select all

wine cmd < path/to/your/file.bat
.
you can also use start.exe...

wine start path/to/your/file.bat
User avatar
DanKegel
Moderator
Moderator
Posts: 1164
Joined: Wed May 14, 2008 11:44 am

Post by DanKegel »

I do this all the time. It's
wine cmd /c foo.bat
Locked