ANtMAn1

Hi All,

I wrote a c# .net app for a Host PC that executes a batch file and the batch file uses CECOPY.exe to copy files from a device to the host PC. The batch file works fine when I run it stand alone. When i call it from my app it launches and then I get an error that says: "CECOPY is not recognized as an internal or external command, operable program or batch file." Why am I getting this error and how can I avoid it

Thanks!



Re: Smart Devices VB and C# Projects call a batch file that uses cecopy fromm my application

Christopher Fairbairn

Hi,

Your problem is possibly a current working directory type problem. When you manually run your batch file I assume you are entering the directory when the batch file (and cecopy.exe) lives, hence the current working directory (where the shell by default looks for executables) will contain cecopy.exe. Possibly when you are running your C# application is is launching your batch file with a different current working directory, and hence it can't find cecopy.exe since it is not in the path.

As an alternative, have you looked into using OpenNETCF's OpenNETCF.Desktop.Communication library (available freely at http://www.opennetcf.com/FreeSoftware/DesktopCommunication/tabid/90/Default.aspx).

This would allow you to transfer the file from your PDA to the desktop directly from within your C# code without bothering with cecopy.exe and/or a batch file etc.

Here is a small example using the OpenNETCF wrappers to get your started (it will copy a file called test.txt in the root of the PDA filesystem to C:\test.txt on your desktop).

Code Snippet

using OpenNETCF.Desktop.Communication;

using (RAPI rapi = new RAPI())

{

rapi.Connect(true);

rapi.CopyFileFromDevice(@"C:\test.txt", @"\\test.txt");

rapi.Disconnect();

}

Hope this helps,

Christopher Fairbairn