funny chars in xcopy
Moderator: DosItHelp
-
- Posts: 7
- Joined: 08 May 2017 11:10
funny chars in xcopy
I did an xcopy command to copy the path and file names of about 500,000 files and saved it to a txt file. Some filenames did not keep the accent/funny chars that are part of the file names.
i.e.
This is the actual file name:
1027948_16356344_wk 35 @NIVEA BODY@48965 Body 625ml 77240 CrŠme Soft 250-200ml 24253 Inshower @ AD @ $0 30 $0 50 $0 05 @ RCWC EF_VS.xlsm
This was the result from the xcopy:
1027948_16356344_wk 35 @NIVEA BODY@48965 Body 625ml 77240 Crème Soft 250-200ml 24253 Inshower @ AD @ $0 30 $0 50 $0 05 @ RCWC EF_VS.xlsm
How can I get the correct filename to print as is?
my xcopy command saved in a batch file:
dir "\\USATL02ERAS40\auditfiles\Loblaws\LCL_2016\Z-DT\NDS 2016\Mailtrax NDS 2016\*.xls*" /A /B /S > XLSVndDir2.txt
i.e.
This is the actual file name:
1027948_16356344_wk 35 @NIVEA BODY@48965 Body 625ml 77240 CrŠme Soft 250-200ml 24253 Inshower @ AD @ $0 30 $0 50 $0 05 @ RCWC EF_VS.xlsm
This was the result from the xcopy:
1027948_16356344_wk 35 @NIVEA BODY@48965 Body 625ml 77240 Crème Soft 250-200ml 24253 Inshower @ AD @ $0 30 $0 50 $0 05 @ RCWC EF_VS.xlsm
How can I get the correct filename to print as is?
my xcopy command saved in a batch file:
dir "\\USATL02ERAS40\auditfiles\Loblaws\LCL_2016\Z-DT\NDS 2016\Mailtrax NDS 2016\*.xls*" /A /B /S > XLSVndDir2.txt
Re: funny chars in xcopy
Try to change the code page beforehand. Assuming Windows-1252 as your default ANSI code page ...
Steffen
Code: Select all
>nul chcp 1252
Steffen
-
- Posts: 7
- Joined: 08 May 2017 11:10
Re: funny chars in xcopy
that did not work, thanks
Re: funny chars in xcopy
Sorry but then I don't get you.
Steffen
Steffen
-
- Expert
- Posts: 1160
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: funny chars in xcopy
It might not be 1252. You'll have to play around with the number before you find the right one.
If you open a command prompt and just type CHCP, what number appears?
If you open a command prompt and just type CHCP, what number appears?
Re: funny chars in xcopy
abenitez77 wrote:my xcopy command saved in a batch file:
dir "\\USATL02ERAS40\auditfiles\Loblaws\LCL_2016\Z-DT\NDS 2016\Mailtrax NDS 2016\*.xls*" /A /B /S > XLSVndDir2.txt
That is a funny XCOPY command.
-
- Posts: 7
- Joined: 08 May 2017 11:10
Re: funny chars in xcopy
I meant dir...my head was somewhere else while multitasking...
Re: funny chars in xcopy
OEM code page 437 should be related to ANSI code page 1252.
I saved the following code to Crème.batContent of test.txt after running
Code with chcp addedtest.txt
If you're not sure if 1252 is your current ANSI code page run info.bat
viewtopic.php?f=3&t=7420&p=49133#p49133
Steffen
I saved the following code to Crème.bat
Code: Select all
@echo off
>"test.txt" dir /a-d /b
Code: Select all
CrŠme.bat
test.txt
Code with chcp added
Code: Select all
@echo off
>nul chcp 1252
>"test.txt" dir /a-d /b
Code: Select all
Crème.bat
test.txt
If you're not sure if 1252 is your current ANSI code page run info.bat
viewtopic.php?f=3&t=7420&p=49133#p49133
Steffen
-
- Posts: 7
- Joined: 08 May 2017 11:10
Re: funny chars in xcopy
The results I got back were correct:
CrŠme.bat
test.txt
seems the issue is in the SQL Server Import I am doing.
Thanks!
CrŠme.bat
test.txt
seems the issue is in the SQL Server Import I am doing.
Thanks!