Windows Environmental Variables - Path

Questions about Wine on Linux
Locked
shag00
Level 2
Level 2
Posts: 47
Joined: Mon Sep 11, 2017 11:04 pm

Windows Environmental Variables - Path

Post by shag00 »

I am just testing if it is possible to do my video post production work on ubuntu and part of that relies on using the windows program eac3to which is a command line program. That being the case I need to set the path in Wine so that I can use it. My googling so far has led me to believe that there are 2 ways to achieve this; first through the use of the wine cmd command and secondly through the "windows" registery.

I think part of the problem with the first option is the syntax, I don't know whether to use, wine C:\, C:\, or /home/drive_c/. I have a preference to use the first method.

Wine is located in the default location /opt/wine-devel
eac3to is a portable program and is located in /home/.wine/drive-c/portable/eac3to/eac3to.exe

If anyone could help me out please...
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Windows Environmental Variables - Path

Post by Bob Wya »

@shag00

You can pass standard arguments to a Windows executable using your good ol' BASH Shell:

Code: Select all

wine start 'C:\portable\eac3to\eac3to.exe' input.file+input.file.2 output.file -options
Just watch out for characters your BASH Shell will eat (e.g. \ , ! , etc.) - these will need to protected with quotes.

See: 3.1 How to install and run Windows programs ...

Of course native Linux video processing tools are probably always preferable... 8)

Bob
shag00
Level 2
Level 2
Posts: 47
Joined: Mon Sep 11, 2017 11:04 pm

Re: Windows Environmental Variables - Path

Post by shag00 »

@Bob Wya

Firstly, thanks for your reply, I have met with some limited success using your method, eac3to did invoke and did split my file into the 6 files I was hoping for, this was the limit of my success. A couple of problems presented themselves:
1/ the files did not have the names I specified,
2/ the files were not saved to the directory I specified,
3/ some errors were encountered,
4/ the process did not finish (needed to CTRL-C to get to prompt).

The appropriate directories were set up and I ran this command: wine start 'C:\portable\eac3to\eac3to.exe' Music/y/shag.ac3 Music/z/shag.wavs

The following error messages were received:
scott-pc@angelpc:~$ wine start 'C:\portable\eac3to\eac3to.exe' Music/y/shag.ac3 Music/z/shag.wavs
fixme:exec:SHELL_execute flags ignored: 0x00000100
scott-pc@angelpc:~$ fixme:msg:ChangeWindowMessageFilterEx 0x10066 400 1 (nil)
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded

The requested file name was shag.c.wav instead I got musiczshag.c.wav (same for l,r,lfe,sr and sl)

The requested save directory was music/z but was actually just saved in Home.

Any ideas/suggestions?
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Windows Environmental Variables - Path

Post by Bob Wya »

shag00 wrote:@Bob Wya
The appropriate directories were set up and I ran this command:

Code: Select all

wine start 'C:\portable\eac3to\eac3to.exe' Music/y/shag.ac3 Music/z/shag.wavs 
The following error messages were received:

Code: Select all

scott-pc@angelpc:~$ wine start 'C:\portable\eac3to\eac3to.exe' Music/y/shag.ac3 Music/z/shag.wavs
fixme:exec:SHELL_execute flags ignored: 0x00000100
scott-pc@angelpc:~$ fixme:msg:ChangeWindowMessageFilterEx 0x10066 400 1 (nil)
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
The requested file name was shag.c.wav instead I got musiczshag.c.wav (same for l,r,lfe,sr and sl)

The requested save directory was music/z but was actually just saved in Home.

Any ideas/suggestions?
You're using Unix style paths for a Windows application - hence the weird issues you experienced.
Your Unix present working directory (pwd) is ~ or "${HOME}".
The pwd working path is passed onto Wine and thus to your Windows application.
Your relative path, to your pwd, contains invalid characters for a Windows filename ( / ) - these are striped leaving:

Code: Select all

.\Musiczshag.wavs
Of course Wine accesses Windows files and paths in a case-insensitive way - in a similar way to how Windows does.
Hence your final output file:

Code: Select all

"${PWD}\musiczshag.wavs"
Try (converting your Unix relative paths to Windows paths on the fly):

Code: Select all

wine start 'C:\portable\eac3to\eac3to.exe' "$(winepath -w "Music/y/shag.ac3" 2>/dev/null)" "$(winepath -w "Music/z/shag.wavs")" 2>/dev/null)"
See: WineHQ Wiki: Winepath ...

This can get quite fiddly - if you combine calls to winepath into your Wine command (like I've done above)...
If the Unix Shell gets access to the output from winepath - before Wine passes the arguments to your Windows application - it will strip the weak " quotes - then you've got your paths messed up again!

Alternatively, just manually generate the relative Windows paths or just copy-paste the output from winepath:

Code: Select all

wine start 'C:\portable\eac3to\eac3to.exe' '.\Music\y\shag.ac3' '.\Music\z\shag.wavs'
or absolute (guestimate):

Code: Select all

wine start 'C:\portable\eac3to\eac3to.exe' 'Z:\home\scott-pc\Music\y\shag.ac3' 'Z:\home\scott-pc\Music\z\shag.wavs'
The Linux root directory ( / ) is typically mapped to drive Z: in a WINEPREFIX...

Remember \ has a special meaning for Unix shells. To use it as a Windows path delimiter (with Wine) you need to use strong/single quotes: '
See 8.19 "Special" Characters and Operators ...



Btw plz use the supplied forum Code

Code: Select all

Code
tags!!

It's one of my pet (OCD) hates when people omit these... Makes posts easier to read - using them for all commands and terminal output... :lol:

Bob
shag00
Level 2
Level 2
Posts: 47
Joined: Mon Sep 11, 2017 11:04 pm

Re: Windows Environmental Variables - Path

Post by shag00 »

@Bob Wya,

making progress!!!!!

I used:

Code: Select all

$ wine start 'C:\portable\eac3to\eac3to.exe' 'Z:\home\scott-pc\Music\y\shag.ac3' 'Z:\home\scott-pc\Music\z\shag.wavs'
and found it works a treat, though there is still the error and hang (that requires CTRL-C to regain the prompt):

Code: Select all

scott-pc@angelpc:~$ wine start 'C:\portable\eac3to\eac3to.exe' 'Z:\home\scott-pc\Music\y\shag.ac3' 'Z:\home\scott-pc\Music\z\shag.wavs'
fixme:exec:SHELL_execute flags ignored: 0x00000100
scott-pc@angelpc:~$ fixme:msg:ChangeWindowMessageFilterEx 0x10066 400 1 (nil)
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
As I said in my first post I was fairly surely sure my syntax was part of the problem so to ask a question of principle, is it correct to say that when issuing a command that starts with WINE, that all subsequent input needs to be in Windows syntax and that this is also true in the case of using the windows command line interface accessed through the WINE CMD?
shag00
Level 2
Level 2
Posts: 47
Joined: Mon Sep 11, 2017 11:04 pm

Re: Windows Environmental Variables - Path

Post by shag00 »

Ok, I now have eac3to working perfectly when run from the "windows" command line. All it required was modifying the registry to include a path to the executable. My previous attempts to change the registry were unsuccessful because I attempted to follow the Wine User's Guide posting.php?mode=reply&f=8&t=29458 , section 3.6.6. which is just incorrect in it's instructions and very poorly written. Anyway, following is how you modify the registry to set the path you want:

Code: Select all

wine regedit
Then in the left hand side pane, navigate to HKEY_CURRENT_USER and expand it, you are looking for the Environment key.
Right click the Environment key and left click New/String Value.
In the resultant box type "Path" and hit ENTER
Right click on Path and left click Modify...
A pop-up appears, in the Value Data Box type: c:\windows;c:\windows\system; followed by the location of the folder containing the executable you wish to run. NB the folder separator ";".

Please note this procedure is applicable to a new install where no Path key has been previously set, if one has already been set then all that needs to be done is modify the existing data by adding a semi colon and path to the executable you want to use without adding the windows or windows/system paths again.

In the following (attached) image I have set a path to eac3to.exe whose address is (unix): /home/mypc/.wine/drive_c/portable/eac3to/eac3to.exe or (windows) C:\portable\eac3to\eac3to.exe

[img]
regedit.png
Finally,

Code: Select all

wine cmd
and use eac3to as if it were running on windows.
User avatar
dimesio
Moderator
Moderator
Posts: 13205
Joined: Tue Mar 25, 2008 10:30 pm

Re: Windows Environmental Variables - Path

Post by dimesio »

Wine User's Guide, section 3.6.6. which is just incorrect in it's instructions and very poorly written.
I just took a look at that section, and I agree. My guess is that those instructions were correct when they were written, but now are extremely outdated; the default wineprefix has never been in /usr/local for as long as I've been using Wine, and that's over 9 years.
Locked