none
startup commands RRS feed

  • Question

  • Is there a way to run shell commands at startup?

    I want to connect a network share on bootup.  One way is to run "net use blah."  Is there a registry entry for startup commands in WEC 7?

    Thanks.

    Wednesday, May 1, 2013 4:40 AM

Answers

  • Luka, have you actually done that?  If so, I am surprised that it would work for two reasons; CreateProcess doesn't run BAT files and BAT files can't call SignalStarted().

    I suspect that what really needs to be done is to create a small EXE that either runs the BAT file, or runs net and passes the command line arguments.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com

    • Proposed as answer by LukecPivk Wednesday, May 1, 2013 12:45 PM
    • Marked as answer by Ian D Johnston Wednesday, May 1, 2013 4:52 PM
    Wednesday, May 1, 2013 12:44 PM
    Moderator

All replies

  • Hi,

    Write a bat script and put in the commands then put  the path to bat in 

    [HKEY_LOCAL_MACHINE\init]
    "Launch150"="script.bat"

    Thats what i would do.

    regards,

    Luka

    Wednesday, May 1, 2013 8:46 AM
  • Luka, have you actually done that?  If so, I am surprised that it would work for two reasons; CreateProcess doesn't run BAT files and BAT files can't call SignalStarted().

    I suspect that what really needs to be done is to create a small EXE that either runs the BAT file, or runs net and passes the command line arguments.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com

    • Proposed as answer by LukecPivk Wednesday, May 1, 2013 12:45 PM
    • Marked as answer by Ian D Johnston Wednesday, May 1, 2013 4:52 PM
    Wednesday, May 1, 2013 12:44 PM
    Moderator
  • No I didnt try it, and I didnt know that it wont work, then your sollution is the best one.

    Wednesday, May 1, 2013 12:45 PM
  • Does that mean if I put "startup.bat" into hklm\init then the system will hang on startup?

    I can create "startup.bat" which runs all my init stuff and call that from "startup.exe", which I put in hklm\init.

    How do I call a .bat file (or for that matter, any system command) from an exe?  Or is that a separate thread?

    Wednesday, May 1, 2013 4:20 PM
  • Nevermind.  Found CreateProcess().  I'll use that in an exe, then put the exe in HKLM\init.  Thanks.
    Wednesday, May 1, 2013 4:52 PM
  • And don't forget to call SignalStarted() from your startup.exe.

    See http://geekswithblogs.net/BruceEitman/archive/2008/06/30/windows-ce-starting-an-application-when-the-system-boots.aspx


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com

    Wednesday, May 1, 2013 6:45 PM
    Moderator