Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3458246
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:57:33+00:00 2026-05-18T09:57:33+00:00

I wrote a small batch file to rar all contents in all subfolders within

  • 0

I wrote a small batch file to rar all contents in all subfolders within a folder. It works fine except for that the file names should be in ASCII. Below is the working small code:

@REM ------- BEGIN rarthem.bat ----------------
@setlocal
@echo off
echo --------------------------------------------------
echo Starting to rar files
echo --------------------------------------------------
echo.
echo.
echo.
set path="C:\Program Files\WinRAR\";%path%
for /D /r %%G in ("*") do (
    echo Storing files in %%G
    echo --------------------------------------------------

    cd %%G

    for %%I in (*.*) do (
        rar a -x*.rar -x*.zip -m0 -id[c] "%%~nI.rar" "%%I"
        echo Done archiving %%~nI%%~xI
    )

    echo --------------------------------------------------
    echo Done archiving %%~nG
    echo --------------------------------------------------
    echo.
    echo.
    cd ..
)

echo Finished!
pause
REM ------- END rarthem.bat ------------------

I think the problem happens when the file name is parsed to WinRAR as WinRAR has no problem archiving files with Unicode names.

Edit: When parsing the file name to WinRAR, the file name gets modified so when WinRAR tries to look for the file under that name, it can’t find it. For example a file: téxt.pdf will become text.pdf when parsed.

A small side question: I’ve not tried using 7zip, would it be easier to achieve the same thing with 7zip?

Many thanks for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:57:33+00:00Added an answer on May 18, 2026 at 9:57 am

    RAR.exe processes its command-line in the OEM character set (i.e. not unicode). The only way I know of to pass a unicode name to it is via a list file, when also using the argument to specify that the list file is unicode. However, that only works for files inside the archive (EDIT: or files you want to add to the archive). For the archive name itself I don’t know of a solution except…

    If you use WinRAR.exe instead of RAR.exe then you can pass unicode filenames on the command-line and they work fine. You will see a GUI progress window but other than that (which may or may not matter to you) WinRAR.exe is suitable for running from batch scripts.

    Whether a batch script itself can cope with unicode I do not know, but if that is the only problem remaining I would switch to using VBScript or JScript instead of a batch file. (Which is worth doing anyway, IMO. I’m not a big fan of VBScript and JScript but at least they don’t have completely insane, arcane semantics and limitations like batch does. :))

    By the way, if you do use WinRAR.exe you might want to get the recent WinRAR 4 (beta 2 currently) as it includes the ability to specify the working directory, previously only possible with rar.exe. That can be essential if you need to add files from read-only directories.

    If you want to learn about the list files I mentioned, check the RAR.exe text-file document or the WinRAR.exe built-in online help for all the details.

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a small executable in C# .NET that manages a .jar file. Our
I wrote a small program with Boost in c++. It works fine and so
I wrote a small app that turns out to be using a lot of
I wrote a small program, that creates files at an interval of 1 minute.
I am trying to write a small batch file for a task I do
Background I have a Spring batch program that reads a file (example file I
I need to write a batch file to unzip files to their current folder
I wrote small service class and I want implement something like that : service
I wrote a small program to simply load a Wavefront OBJ mesh file and
i wrote a small FQL script that returns the latest wallposts of my fanpage.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.