Re: Autolaunch a .bat file
From: Michael--J (MichaelJ_at_discussions.microsoft.com)
Date: 11/30/04
- Next message: Max Mayer: "DeviceIOControl takes too long"
- Previous message: bytekeeper: "Re: Why does FileSystem resets date/time to 1.1.2003 - 0:12:0 each boot?"
- In reply to: Yannick Chamming's [eMVP]: "Re: Autolaunch a .bat file"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 29 Nov 2004 23:37:04 -0800
Yes, i considered using the startup directory however there is one problem if
i do that: I have a shortcut link in that directory which runs another app.
The main purpose of my batch file is to update that particular app. So if i
put my batch file in the startup directory... what if the other app it's
supposed to update runs first? Then the batch file wont be able to update it.
So as a requirement, i need the batch file to run first.
I then tried writing a eVC++ program (called AutoPatch.exe) that looks like
this:
#include "stdafx.h"
#include <windows.h>
#include <winbase.h>
#include <tchar.h>
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
PROCESS_INFORMATION ProcInfo;
// Let the system know we're done initializing.
SignalStarted( 0x28 );
// Launch cmd.exe here
CreateProcess( L"cmd.exe", L"/C \\HardDisk\\patch.bat", NULL, NULL, FALSE,
CREATE_NEW_CONSOLE,
NULL, NULL, NULL, &ProcInfo );
return 0;
}
This app is located in the \Windows folder and it's main purpose is to run
patch.bat using cmd.exe. Would having patch.bat in \HardDisk be a problem? I
remember reading that the hard disk may not be mounted when Init enumerates
its entries. Thanks.
"Yannick Chamming's [eMVP]" wrote:
> As long as the Hard Disk directory is available, you should be able to
> launch something from it. Now, I'm not sure that CE is able to launch .bat
> files. I think you'd better try launching cmd.exe with the right options.
>
> One thing you have to know : the HKLM\Init key startup mechanism
> automatically add to command line of the process launched the "Launch
> number" (in your case : 40). Maybe you should consider using the startup
> directory, which basically have the same goal, but at a more "applicative
> level".
>
> --
> ----------------------------------------------------------------
> Yannick Chamming's (eMVP)
> ADESET
> Windows Embedded Manager
> ychammings AT adeset DOT com>
> http://www.adeset.com
> Tél : +33 (0)4.72.18.57.77
> Fax : +33 (0)4.72.18.57.78
> ----------------------------------------------------------------
>
> "Michael--J" <MichaelJ@discussions.microsoft.com> wrote in message
> news:64326806-B444-4476-9D4B-B7CC8EC0C532@microsoft.com...
> > I tried changing the registry to:
> >
> > [HKEY_LOCAL_MACHINE\init]
> > "Launch40"="\HardDisk\patch.bat"
> >
> > But it still doesn't work. The contents of my batch file is this:
> > MOVE "\HardDisk\file.txt" "\HardDisk\test\file.txt"
> > CLS
> >
> > Does the file specified in the registry have to be part of the OS image?
> > Does it need to be an .exe or can it be a .bat? Can it be located in the
> > \HardDisk? Thanks.
> >
> > "Michael--J" wrote:
> >
> > > Hi,
> > >
> > > is there any way of autolaunching a batch file in CE 5.0? All i want to
> do
> > > is basically rename, delete, and move some files upon startup. I have
> tried
> > > the following:
> > >
> > > [HKEY_LOCAL_MACHINE\init]
> > > "Launch40"="patch.bat"
> > >
> > > [HKEY_LOCAL_MACHINE\Loader]
> > > "SystemPath"=multi_sz:"\\HardDisk","\\Release\\"
> > >
> > > patch.bat is the batch file i want to execute and is located in
> \HardDisk. I
> > > tried this out but it didn't work because the associated files i wanted
> to
> > > change didn't change. Is there another approach to this? Thanks
>
>
>
- Next message: Max Mayer: "DeviceIOControl takes too long"
- Previous message: bytekeeper: "Re: Why does FileSystem resets date/time to 1.1.2003 - 0:12:0 each boot?"
- In reply to: Yannick Chamming's [eMVP]: "Re: Autolaunch a .bat file"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|