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 674337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:41:43+00:00 2026-05-14T00:41:43+00:00

I’m trying to delete some files with unicode characters in them with batch script

  • 0

I’m trying to delete some files with unicode characters in them with batch script (it’s a requirement). So I run cmd and execute:

> chcp 65001

Effectively setting codepage to UTF-8. And it works:

D:\temp\1>dir
 Volume in drive D has no label.
 Volume Serial Number is 8C33-61BF

 Directory of D:\temp\1

02.02.2010  09:31    <DIR>          .
02.02.2010  09:31    <DIR>          ..
02.02.2010  09:32               508 1.txt
02.02.2010  09:28                12 delete.bat
02.02.2010  09:20                95 delete.cmd
02.02.2010  09:13    <DIR>          Rún
02.02.2010  09:13    <DIR>          Гуцул Каліпсо
               3 File(s)            615 bytes
               4 Dir(s)  11 576 438 784 bytes free

D:\temp\1>rmdir Rún

D:\temp\1>dir
 Volume in drive D has no label.
 Volume Serial Number is 8C33-61BF

 Directory of D:\temp\1

02.02.2010  09:56    <DIR>          .
02.02.2010  09:56    <DIR>          ..
02.02.2010  09:32               508 1.txt
02.02.2010  09:28                12 delete.bat
02.02.2010  09:20                95 delete.cmd
02.02.2010  09:13    <DIR>          Гуцул Каліпсо
               3 File(s)            615 bytes
               3 Dir(s)  11 576 438 784 bytes free

Then I put the same rmdir commands in batch script and save it in UTF-8 encoding. But when I run nothing happens, literally nothing: not even echo works from batch script in this case. Even saving script in OEM encoding does not help.

So it seems that when I change codepage to UTF-8 in console, scripts just stop working. Does somebody know how to fix that?

  • 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-14T00:41:43+00:00Added an answer on May 14, 2026 at 12:41 am

    If you want to have unicode supported in batch file, then CHCP on a line by itself just aborts the batch file. What I suggest is putting CHCP on each batch file line that needs unicode as follows

    chcp 65001 > nul && <real command here>
    

    Example: In my case I wanted to have a nice TAIL of my log files while debugging, but the content for even Latin-1 characters was being messed up. So here is my batch file which wraps the real tail implementation from Windows Resource Kit.

    @C:\WINDOWS\system32\chcp.com 65001 >nul && tail.exe -f %1
    

    In addition, for output to a console, you need to set a true type font, i.e. Lucidia Console.

    And apparently for output to a file the command line needs to run as Unicode, so you would kick off your batch script as follows

    cmd /u /c <batch file command here>
    

    Disclaimer: Tested on Windows XP sp3 with Windows Resource Kit.

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

Sidebar

Ask A Question

Stats

  • Questions 382k
  • Answers 382k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to sink DWebBrowserEvents2 and respond to the WindowStateChanged… May 14, 2026 at 10:37 pm
  • Editorial Team
    Editorial Team added an answer When you say "... everything that uses JavaScript ... doesn't… May 14, 2026 at 10:37 pm
  • Editorial Team
    Editorial Team added an answer That's the general idea. The IV does not need to… May 14, 2026 at 10:37 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.