Special characters in batch

June 30, 2009 at 18:30:51
Specs: Windows Vista
Hey i have this problem, i use this script to update my iTunes music catalogue ...

"%PROGRAMFILES%\iTunes Library Updater\ITLUconsole.exe" /a /l /r "K:\Media\Søren\Musik"

but when i run it is cant read the "ø" so it says invalid location...

and i cant move the folder, because i got to many files and too many programs depending on it...

See More: Special characters in batch

Report •

July 1, 2009 at 02:09:41
Extended characters are a bit of a problem in batch.

There are two main ways to achieve what you want to do, either
change the code page or find the character that is used for
your characters alias.

Changing the code page is probably the easiest, here is something
that may work:

for /f "tokens=2 delims=:" %%a in ('2^>nul chcp') do set cp=%%a
>nul 2>&1 chcp 1252
"%PROGRAMFILES%\iTunes Library Updater\ITLUconsole.exe" /a /l /r "K:\Media\Søren\Musik"
>nul 2>&1 chcp%cp%

It first sets the current code page number to %cp% changes
to codepage 1252, which can handle the character then executes
you command then restores the original code page to avoid other

The other way would be to use a "alias" character specific to
your code page.

copy the character in question.
type in "echo "
right click>paste
now type in ">filename.txt" and hit enter (it should now
look like "echo ø>filename.txt")
type in "start notepad filename.txt"
copy the character from notepad and use it in place of
the character in question within the script.

Either method should have levels of success.

Report •
Related Solutions

Ask Question