Windows BAT script for cp alias produces error

146 views Asked by At

I wrote a file called cp.bat and the content of this file is: DOSKEY cp=COPY $* copy. I saved this file in c:\users\myname\aliases. I also added this path to my environment so cmd can execute it.

When I now type cp in my cmd the output is a strange character for the c in cp.

enter image description here

I need this script to work because I want to install chicken scheme eggs on my machine, but the chicken-install command executes multiple cp commands and those are not recognized in the cmd.

I also tried to alter the build script of the eggs, but it gets newly generated everytime I call the chicken-install command.

It would also help if someone could explain me how to install chicken eggs on a windows machine correctly. I feel this workaround shouldn't be necessary. Thanks in advance.

2

There are 2 answers

0
Echon On BEST ANSWER

Like Magoo mentioned:

In all probability, your editor is the root of your problem. Batch files should be created in strict ANSI format using a text-editor, not a word-processor. Notepad is barely adequate; Notepad++ is far better - I use Editplus

The encoding was messed up and it was set to UTF-8-BOM, so I changed it to ANSI and it worked flawlessly.

0
sjamaan On

If you're using CHICKEN 5, it should not be emitting cp commands; it should emit batch files which use the builtin Windows commands only if you're using the mingw platform target. Have you used the PLATFORM=mingw option with every make invocation?

If you're using the mingw-msys (or cygwin) platform, then it will be emitting UNIX style commands.