AutoRun a Batch File (A more powerful AutoRun)

Applications, examples, and sample programs using products from Comfile Technology

AutoRun a Batch File (A more powerful AutoRun)

Postby Mike » Sun Jul 17, 2011 5:38 pm

Do you need to take control of the AutoRun feature? This sample illustrates how to AutoRun a batch file, so you can automatically start one or more executables, pass arguments to your executables, and more. This sample simply executes a windows command prompt, which then processes commands in a batch file. So, if you can do it in a batch file, you can do it at start up.

* This technique leverages the Process class to start a windows command prompt (cmd.exe) and execute a batch file - http://msdn.microsoft.com/en-us/library ... .90%29.asp.
* C# and VB.Net Projects are attached. Although these projects were made for the CUWIN 5000/6000 series, I believe the same code can be used for the CUWIN 3000/4000 series.

To Use:
1. Compile and Copy BatchAutoRun.exe to the "/Flash Disk/AutoRun" folder. It must be the only executable in that folder. You can have other executables in subfolders.
2. Be sure to set the dipswitch on the right-side of the CUWIN to 1 ON, 2 ON, the rest OFF to enable AutoRun mode
3. Create a text file called BatchAutoRun.bat in the same folder, and add whatever commands you wish. To start a program, add a line like this
Start "<Path To My Program.exe>" arg1 arg2 etc..
For more about Start see http://technet.microsoft.com/en-us/libr ... 10%29.aspx
4. The CUWIN will execute BatchAutoRun.exe, which will execute cmd.exe, which will process BatchAutoRun.bat, which will execute whatever you entered in BatchAutoRun.bat.
Attachments
BatchAutoRun_VB.zip
VB.Net Project
(28.93 KiB) Downloaded 736 times
BatchAutoRun.zip
C# Project
(15.46 KiB) Downloaded 720 times
Mike
Mike
SuperDuperDuper
 
Posts: 551
Joined: Thu Mar 17, 2011 3:54 pm
Location: Seoul, South Korea

Re: AutoRun a Batch File (A more powerful AutoRun)

Postby gunta » Wed May 30, 2012 4:47 am

Hello Mike,

I have followed your instructions, but it does nos work for my CUWIN3100. Any explanation, please?

Thank you,
-gunta
gunta
MasterGoo
 
Posts: 2
Joined: Wed May 30, 2012 4:24 am

Re: AutoRun a Batch File (A more powerful AutoRun)

Postby Mike » Wed May 30, 2012 3:40 pm

When you say "It doesn't work", what exactly isn't working. Do you get an error? Please provide more information.

The projects in the original post are for the CUWIN 5000 and 6000 series CUWINs and are configured for the .Net Compact Framework 3.5. However, the 3000/4000 series CUWINs only support the Compact Framework 2.0. So, using Visual Studio, create a project for the .Net Framework 2.0 and copy Program.cs into that project. This should be sufficient to get it working for the 3000/4000 series. Also, make sure the CUWIN is configured for AutoRun by setting dip switch 2 ON and the rest OFF.
Mike
Mike
SuperDuperDuper
 
Posts: 551
Joined: Thu Mar 17, 2011 3:54 pm
Location: Seoul, South Korea

Re: AutoRun a Batch File (A more powerful AutoRun)

Postby gunta » Fri Dec 20, 2013 12:12 am

Hello Mike,

Yes, the Autorun is work. I could run the .exe within the Autorun folder. However, here we modify the registry HKLM/init to autostart the application. Both ways are work fine.

FYI, editing the HKLM/init is risky. We try to run the application before the device.exe application, the result is the device could not boot to Win CE. I am now communicating with support from Comfile and suggest me to restore the operating system. I am preparing to perform the operating system restore. I hope my operating system of CUWIN 3000 will get back alive soon.
gunta
MasterGoo
 
Posts: 2
Joined: Wed May 30, 2012 4:24 am


Return to Applications and Examples

Who is online

Users browsing this forum: No registered users and 2 guests

cron