File names with Japanese characters in batch script not working

Hey there.

I seem to be having some problems with making a button for Dopus.

What I want to do is to run FFMpeg for the selected files in the lister. But it seems that Dopus does not like Japanese characters.

Is there any way around this? These commands work fine in a regular command prompt window.

Dopus does not like Japanese characters

Opus is fine with Japanese characters, FFmpeg is confused by wrongly placed quotes.

What do you mean by wrongly placed quotes?

Opus will place quotes only around {file}, not around new-{file}. Place echo before the ffmpeg command and you'll see what I mean.

Thanks for elaborating. I am still not sure if I get it.

I can change:

ffmpeg -i {file} -c copy new-{file}


ffmpeg -i {file} -c copy "new-{file}"

The result will still be the same ("new-02 ???.m4a"). Also if I just change the Japanese characters to latin everything works fine. Are you sure we are on the right path here?

DOS batch files will not properly handle characters that cannot be expressed in your locale's codepage.

That's a limitation of MS-DOS/Bat files rather than Opus.

If short names are enabled on the drive, you can pass the short version to the command, which works around the issue.

Otherwise, don't use the MS-DOS Batch Function mode. The other modes don't have any issues with Unicode. DOS is just archaic at this point.

(Setting the system locale to UTF8 may also work, but is a fairly new option which could cause issues with some software. )

I must admit that this is way over my head. I can do simple PowerShell or batch files, but that is pretty much it.

Then why does this batch file work for this scenario?

@echo off
FOR %%i IN (*.m4a) DO ffmpeg -i "%%i" -c copy new-"%%i"

Seems o do the job, just not with a button.

The funny thing about that statement is that the reason why I am here is because I rewrote a PowerShell script to batch, just because Dopus doesn't support PowerShell and I don't know any JScript or VBScripting. Or maybe there is anything else I can use?

No idea, see what commands both things are generating/executing to see what the difference is. It may just be passing short names.

You can run a PowerShell .ps1 script from an Opus button. (You just can't put the script itself into the button.)

If you understand PS and Bat files already, JScript or VBScript should be trivial to learn as well. Have a look at the default script Opus gives you when you make a new button and switch it to script mode, and the basics should become clear just from that.

Short names? What is that?

I don't know that this actually helps with the problem at hand, but to answer the question:

Once upon a time in DOS, file names were limited to eight characters (plus extension). This might have still been true in early versions of Windows. I don't know.

At some point long filenames with which we are all familiar today became allowed, but (probably for compatibility purposes) each file continued to have a short name in the background. Somelongname.txt would typically have a short name SOMEL~.txt.

I don't know to what extent these names still exist, but if in a command prompt I enter the command dir /x, I see them.

OK thanks for all the help so far.

I am going to be honest and say that I am a little reluctant to learning VBscripting and I feel like it sort of defeats the convenience of using Dopus, but I am willing to give it a try.

Is anyone willing to help me out a little with the example at hand? I don't want people to do the job for me, but I also know that a little help will give me a kick in the right direction :sweat_smile:

Short names only use ASCII characters, and so don't cause problems with things that can't understand Unicode. They aren't always enabled anymore (and may be turned on for some drives and off for others), but if they are available then they provide a very quick and easy workaround for this kind of problem.

The default script I mentioned above will show you lots of things.

The buttons/scripts area of the forum also has lots of additional examples, and the manual has several as well.