Page 1 of 1
ExecuteCommand Copy file
Posted: Mon Oct 23, 2017 1:09 pm
by Mark RMBC
Hi all,
Not sure if this is the appropriate forum for this because I suspect it is more a command line question than a TM1 problem, but here goes anyway
I have a .bat file to copy a csv from one location to another but the csv file name includes a hyphen character (char(150))
When I run the executecommand with the hyphen included I get an error but if I run it without the hyphen it runs ok.
I get the same issue if I run the .bat file outside TM1, i.e. by double clicking it. It just says cannot find file.
I strongly suspect that the command line can’t read the hyphen and is making it a u with circumflex.
The problem is I don’t know how to fix it other than getting the file renamed at source! Any help would be appreciated.
The .bat command is as follows:
Copy "C:\TEMP\06.08 Text Imports 08 Rep Agency*.CSV" "C:\06.08 Text Imports 08 Rep Agency Information New Reqs_A.CSV" > C:\myTestfileA.txt
cheers, Mark
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 4:31 am
by gtonkin
Hi Mark, not seeing the same issue on my side - char 150 is emdash (AFAIK in office/windows and extended ascii in command line, u with circumflex), not a hyphen.
I also notice that you are copying from a list using a wildcard, to one file i.e. last file copied remains-is this what you need or are you wanting to concatenate?
Could you post a dir list of the files so that we can see if there is something else at play.
May also be worthwhile showing what ends up in C:\myTestfileA.txt and any errors written to console.
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 5:02 am
by macsir
Are you merging multiple files into one? I tried file names with both characters ( - and ^) , they are all fine.
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 8:11 am
by Mark RMBC
Hi,
thanks for the feedback, much appreciated.
I am not copying multiple files, only one file. However the source file name will always include the date at the end of the name. So the wildcard just picks up the file for that day and because I am using it as a datasource in a TI process I copy it as the datasource name.
The actual file name is as follows (The first dash is char 45, which works fine but the second is char 150, which appears to stop the command working. The C:\myTestfileA.txt simply says 0 file(s) copied.)
06.08 Text Imports - 08 Rep – Agency Information New Reqs_05092017
This is supposed to end up with the name:
06.08 Text Imports - 08 Rep – Agency Information New Reqs
If I put the second dash, the char 150, in the destination part of the .bat copy process the name of the file created is as follows:
06.08 Text Imports - 08 û Rep Agency Information New Reqs_Load
Notice how the second dash, the char 150 is now converted to u with circumflex
macsir – your dash is char 45 not char 150?
cheers, Mark
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 10:31 am
by gtonkin
Having a problem creating a file with the char(150) in the name-tried Excel VBA, File explorer etc. and it keeps replacing with a normal dash.
Could you upload a sample file, without the data of course.
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 10:52 am
by Mark RMBC
Please see attached file:
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 11:10 am
by tomok
I'm just going to cut to the chase. Any person and/or system that would use the embash character (chr150), or for that matter any character that doesn't appear on the keyboard, in a file name is an idiot. You need to go to this person, slap them silly, and make them change their system to give you a decent file name and be done with it.
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 11:26 am
by Mark RMBC
Yes Tom I arrived at that conclusion also!
I have actually asked for the file name to be changed, but out of curiosity was wondering if anyone had a solution!
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 11:29 am
by gtonkin
As soon as I save the file, seems to lose the char(150) and substitutes with a regular hyphen-cannot really do much more. Hopefully they will rename and you can move forward. I have had similar filenames in the past for Unix environments but managed to work with them by simply surrounding names in double quotes, as you had. Good luck.
Re: ExecuteCommand Copy file
Posted: Tue Oct 24, 2017 11:44 pm
by macsir
of course, mine is printable keyboard dash, just let you know.

Re: ExecuteCommand Copy file
Posted: Wed Oct 25, 2017 8:57 am
by Mark RMBC
Appreciate all your efforts.
I have managed to get the file name changed! The other option would have been to put an asterix before the char 150 dash but fortunately don’t have to do this!