Topic: Custom EXE To Run At Boot Time  (Read 9382 times)

Custom EXE To Run At Boot Time
« on: October 31, 2012, 11:44:27 PM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Hello. Built my first Win7PE last night and got allot of my custom stuff working but was wondering how do you specify an exe or a cmd to run at boot time. I have a cmd I complied into an exe that after PE Network runs, this command will connect us to the in house server to copy data to

Code: [Select]
@echo off
Title Auto Connect To Superman
color 9f
rem Timeout.exe 20

net use Z: \\superman\Data /user:superman\superman **********
IF NOT %ERRORLEVEL% == 0 Goto A

:Desktop
nircmd shortcut "Z:\" "~$folder.desktop$" "Superman"
exit


:A
net use A: \\superman\Data /user:superman\superman **********
IF NOT %ERRORLEVEL% == 0 Goto Error

:Desktop
nircmd shortcut "A:\" "~$folder.desktop$" "Superman"
exit


:Error
cls
echo ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
echo.
echo                     !!!PLEASE READ BEFORE YOU CONTACT ME!!!
echo.
echo ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
echo.
echo   A Connection With Superman\Data Was Not Successful. Please Check Your   
echo.
echo   Network Connection And Make Sure Lan Drivers Installed Or That The Ethernet
echo.
echo   Port Is Not Bad. If The Ethernet Port Is Working, The Lan Driver May Not
echo.
echo   Have Installed. Plug In Your USB TO ETHERNET Adapter Or GO To Programs=
echo.
echo   Network=More Lan Drivers And Try To ReInstall The Onboard Lan Drivers. If
echo.
echo   You Have Done All The Above And Still Can't Connect To Superman, Please
echo.
echo   Contact Superman For More Help. :(
echo.
echo ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
pause

EXIT 

I would like this command to run on bootup but after PE stuff. That's why I use Timeout.exe on other XP PE stuff. 

ps..Yes our server name is Superman and Yes I am a huge Superman fan!  :w00t:

Re: Custom EXE To Run At Boot Time
« Reply #1 on: November 01, 2012, 12:04:47 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Himmm, let me give you a step by step instruction:

* for startup thingies,
Use Add_Shortcut,AutoStart syntax,
more info here
http://theoven.org/index.php?topic=50.0
you can see an example here
Win7PESE\Apps\System Tools\"MultiRes"

*
For batch files ;) using
cd /d %~dp0
at very begining may help to solve things when \system32\ folder not used ....
you can see an example here
Gena\Apps\System Tools\"Swap Files"



*
Starting a batch after Penetwork, have 3 ways
+
Penetwork have such an option, on Penetwork plugin use "Start Editor",
than you will see "CMDs after startup" or "CMDs after ip change"...
ps: I do not test this feature long time now, but I hope it is fixed and working now ;)
+
you can set penetwork shutdown after install driver and start network (I can not remember option now but it should be there)
this way,
you can make a Add_Shortcut,AutoStart batch file which at very first
start /wait penetwork
than continue do things you like ;)
+
you already wrote 3rd ;) (which I had also used :>:>)


Still there maybe other ways, I do not auto-start network on my pe builds, but I hope above helps  :great:


Quote
btw, out of topic,
Penetwork plugin also have lan-driver add option, which may workaround what you mention here
http://theoven.org/index.php?topic=294
still it is a workaround of failure of lan-driver integration,
and as all workarounds it has some drawback since penetwork first needs to find driver and install, and than start network ;)

dism experts may write more info there when they have some free time...


See you
 :super_hero:

Re: Custom EXE To Run At Boot Time
« Reply #2 on: November 01, 2012, 12:15:53 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Yes and thank you for the reply. Let me see if I understand. Do I copy my CMD to Win7PE_SE\Workbench\Common\PENetwork_Include. Like the little flying feller you got in your post! lol

Re: Custom EXE To Run At Boot Time
« Reply #3 on: November 01, 2012, 12:32:56 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Yep ;)
this will only copy anything at that folder to system32 :)

but sadly for the rest of things, you need to test and study :)
first test
"Start Editor" -->  "CMDs after startup" or "CMDs after ip change".
options ;) adding your batch name...
If that works, than you get magic quickly  :super_hero:

If not, than check other stuff I mentioned above, there is always "a way"

 :horse:





@ChrisR
Maybe an additional option around IncludeinSys32
a checkbox saying "PeNetwork_After.cmd" (default selected true)
PeNetwork_After_CheckBox=PeNetwork_After.cmd,1,3,320,781,127,18,True
so if end-user add PeNetwork_After.cmd to Win7PE_SE\Workbench\Common\PENetwork_Include\
he would automatically get the magic (hopefully via Penetwork-"CMDs after startup", some ini entry...)

this way, a usual problem of "start after network" mostly solved  :cool:

:ymca:

Re: Custom EXE To Run At Boot Time
« Reply #4 on: November 01, 2012, 01:04:16 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Quote
Start Editor" -->  "CMDs after startup" or "CMDs after ip change".
options ;) adding your batch name...

I have that editor pulled up but will not let me type in the command line part?

Re: Custom EXE To Run At Boot Time
« Reply #5 on: November 01, 2012, 01:07:06 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Ok, I see now. I need to just add the name of the command to run but I guess the pe folder I put the command in will copy to system32 folder and then in command line option in editor, just put the name of my command and it will run from system32 folder?

Re: Custom EXE To Run At Boot Time
« Reply #6 on: November 01, 2012, 02:03:24 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Ok, the cmd did copy to system32 folder but did not run after PENetwork finished. I have been reading this is a bug but not sure if that includes this newer beta version. I also noticed I put drivers in the PE X86 Folder and they didn't load?

Re: Custom EXE To Run At Boot Time
« Reply #7 on: November 01, 2012, 08:35:45 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Hi laddanator,

well, as I mentioned, since I do not use that option (and lack time and interest to test widely) I wrote all possible paths on my first reply  ;)
and like you, I personally use 3rd way with sleep.exe http://theoven.org/index.php?topic=52.0 when a user require "after network" thingies :>
ex: Gena\Apps\Network\Remote Connect\"VNC Real"

Well, don't give up easly, do more tests to achive, there is always a way  :super_hero:
And If / When you succeed, Unlike some other bastards ;) , Post your way so others after you can follow  :thumbsup:

Aside I hope this will be improved to working "magical way" one day, like a ready batch on reply 3 or whatever..


penetwork (and on other topic dism I guess) not able to load/install your lan-driver is a more critical issue I guess, which seems to be working to most people.   :undecided: I hope you can figure out something to feedback on this area (on other topic)


See You
:ymca:

Re: Custom EXE To Run At Boot Time
« Reply #8 on: November 01, 2012, 09:22:56 AM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
For this, I use a batch CmdsAfterstartup.cmd, copied from PENetwork_Include and by using:
 "Start Editor" -->  "CMDs after startup" (on my dhcp profile for me)

Gives me in PENetwork.ini:
Code: [Select]
CMDStart.CMD1=CmdsAfterstartup.cmd
CMDStart.Start1=Normal
CMDStart.Wait1=Yes

It works well for me  :thumbsup:.
It might be a problem related with the loading of your driver or something else I do not know.

Maybe an additional option around IncludeinSys32
a checkbox saying "PeNetwork_After.cmd" (default selected true)
PeNetwork_After_CheckBox=PeNetwork_After.cmd,1,3,320,781,127,18,True
so if end-user add PeNetwork_After.cmd to Win7PE_SE\Workbench\Common\PENetwork_Include\
he would automatically get the magic (hopefully via Penetwork-"CMDs after startup", some ini entry...)

this way, a usual problem of "start after network" mostly solved  :cool:
:thumbsup:
I've also thought about it when I had added "Include files in system32 from this directory:".
But I do not really know how to implement following the profile (default, selected, all profiles) and other information (CMDStart.CMD1, CMDStart.CMD2,...) that may already be included in PENetwork.ini.
If you have an idea how to write it, it would be a good thing to have a default batch launched whatever profile.

ps: I do not have much time this week
:cheers:
« Last Edit: November 01, 2012, 09:27:08 AM by ChrisR »

Re: Custom EXE To Run At Boot Time
« Reply #9 on: November 01, 2012, 09:37:30 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
What I am looking for is an easy way to say end user:

put PeNetwork_After.cmd to Win7PE_SE\Workbench\Common\PENetwork_Include\
and make build

I will write some lines in some 10 minutes, with following penetwork.ini you provided......

CMDStart.CMD1=PeNetwork_After.cmd
CMDStart.Start1=Normal
CMDStart.Wait1=Yes

hehe, sorry we do not have funds to buy time  :lol:
If we have, I may be first time a bit selfish to buy myself  :lol:

See you
:ymca:

Re: Custom EXE To Run At Boot Time
« Reply #10 on: November 01, 2012, 09:48:57 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Quote
CMDStart.CMD1=CmdsAfterstartup.cmd
CMDStart.Start1=Normal
CMDStart.Wait1=Yes

Guys, thanks you so much for the great information. I will try again. Mine says Hidden in that start1 line but I will change it to normal and I think its a driver not be preset is why of course PENetwork can't map the drive. I have an idea and testing now. Your right, Lancelot, I shall never give up!  :thumbsup: Thanks, ChrisR. I will report back soon.

Re: Custom EXE To Run At Boot Time
« Reply #11 on: November 01, 2012, 09:55:30 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Let me ask this off topic really quick or should I start a new topic? When PE is loading, I notice it uses the old Vista boot screen with the green line going back and forth in the little bar like XP. What files do I need to replace or how do I get the Win 7 boot screen to replace the Vista splash sceen or boot screen, which ever it's called?

Re: Custom EXE To Run At Boot Time
« Reply #12 on: November 01, 2012, 10:02:19 AM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
hehe, sorry we do not have funds to buy time  :lol:
If we have, I may be first time a bit selfish to buy myself  :lol:
me too, I buy it :lol:

It would undoubtedly well that Holger adds this option by default and starts PeNetwork_After.cmd, if exist
whatever the profile and in addition to CMDStart.CMD1(..9) linked to the profile.
but we will find a solution.

@laddanator
you can test, notmal/hidden with

PeNetwork_After.cmd
Code: [Select]
echo CmdsAfterstartup %time%
echo CmdsAfterstartup %time%>x:\windows\temp\PeNetwork_After.log
::pause

The Vista boot screen lets start a little faster, this is why it is selected by default
You can change it in Build\1 - Copy Files and enabled "Win7 Animated boot logo (not recommended for slower computers)"

:cheers:

Re: Custom EXE To Run At Boot Time
« Reply #13 on: November 01, 2012, 10:34:57 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Ok, the command ran this time. I didn't do anything different but changed hidden to normal so maybe it ran last time but I didn't see it. Anyway the command is running to early. It is running before the IP is set. Can I put the command on a timeout? Should I use after IP Change?

Re: Custom EXE To Run At Boot Time
« Reply #14 on: November 01, 2012, 10:38:02 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
I copied timeout.exe into the PENetwork_Include (Anything in this folder gets put into system32 folder?) And added this line in my cmd Timeout.exe 20. This will give PENetwork 20 secs to load IP then run

Re: Custom EXE To Run At Boot Time
« Reply #15 on: November 01, 2012, 10:46:04 AM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
I have not retested, but I thought it was good for IP (tested with ipconfig /all)

A tip founded in batch if needed:
For /l %%A in (1,1,5) do (<nul (set/p z=#) & >nul ping 127.0.0.1 -n 2 )    <==  for 5 seconds



Re: Custom EXE To Run At Boot Time
« Reply #16 on: November 01, 2012, 10:49:25 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Hi Chris,

here you go
http://www.mediafire.com/download.php?afmlm6ismcn39vw

not tested but should be working the way you say ...

following  laddanator report maybe "after IP Change" is better .. ??????? which should not require sleep/timeout workaround

Whatever, it will be now quite easy for you to make changes on penetwork plugin  :thumbsup: :thumbsup:

I am pretty sure Holger nothing to do at this point, as long as things work :)
nowadays people get very much more lazy, after these "Stores" (app store, android store....) where things simply downloads and start working :thumbsup:
(which I also like, but also dislike..... )

Re: Custom EXE To Run At Boot Time
« Reply #17 on: November 01, 2012, 11:16:15 AM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
here you go
Yes, it should work this way  :thumbsup:
and indeed if PeNetwork editor is used, the option becomes useless.
I will test it with also "after startup" or "after IP" but not until next week, I have not purchased time  :lol:

:cheers:

Re: Custom EXE To Run At Boot Time
« Reply #18 on: November 01, 2012, 11:18:23 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
I download the script above, Lancelot. I know you directed that to, Chris. What did the new script change. I didn't see anything different? I may have over looked something. I will try the after IP thing. You guys rock! :) 

Re: Custom EXE To Run At Boot Time
« Reply #19 on: November 01, 2012, 11:30:44 AM »

laddanator

  • Chef
  • ***
  • Location: Virgina
  • Date Registered: Oct 2012
  • Posts: 268
Ok, added the timeout command and it worked perfect. The command was run. Now I am trying the after IP thing without the timeout.exe. Still not sure what the new script changed?

 

Powered by EzPortal