Jump to content











Photo
- - - - -

[Win7PE_SE] startup scripts


  • Please log in to reply
22 replies to this topic

#1 biatche

biatche

    Member

  • Members
  • 86 posts
  •  
    Malaysia

Posted 30 November 2011 - 06:12 PM

What are the recommended ways of setting up customized start up scripts -- runonce, ?startnet.cmd?, and after desktop loads. I'm very used to batch scripting and I hope I can run .cmd scripts during start up...

If one is interested to know what I'm trying to do,

1. I want to pxe boot Win7PE_SE (I can already do that),
2. map a network drive (Working -- via PE Network),
3. run a batch script within boot.wim that ensures network connectivity (I first need to work out how to get the .cmd loaded)
4. run my remaining batch scripts off the network drive.
5. My batch script will load an application launcher on the network drive, with shortcuts to applications available on the network drive.
6. One more question is, how do I apply registry tweaks before explorer loads? I wish to customize a couple of explorer settings.

Doing things this way means, to maintain my apps, I can do it on my main pc (where the network drive resides), and I do not need to create a new boot.wim each time. On top of that, I reduce the size of boot.wim as well as the creation time of it.

Im not familiar with winbuilder scripts, and I hope it's not necessary to learn it haha, unless one suggests it's seriously easy.

OK, what are my options?

TQ in advance.

Edited by biatche, 30 November 2011 - 06:19 PM.


#2 RoyM

RoyM

    Frequent Member

  • .script developer
  • 420 posts
  • Interests:"Booting and Owning".
  •  
    United States

Posted 30 November 2011 - 06:54 PM

http://reboot.pro/14319/
  • biatche likes this

#3 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 30 November 2011 - 07:00 PM

Im not familiar with winbuilder scripts, and I hope it's not necessary to learn it haha, unless one suggests it's seriously easy.

I would define it "funnily difficult" :w00t:, unfortunately ;).

The "standard" on a Vista :ph34r: or 7 based PE is WINPESHL.INI, see here:
http://reboot.pro/3033/
http://reboot.pro/13716/

It should allow to pre-process Explorer related Registry entries before starting Explorer, but wouldn't it be better easier to pre-modify them on the "base" Registry inside the .wim?

:cheers:
Wonko

#4 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 30 November 2011 - 10:09 PM

I actually think it is easy to understand the syntax, and "tweak" a script to automate setting up the winpeshl.ini...But YMMV as they say (and the above experts have also given you a lot of good links to go read!

#5 biatche

biatche

    Member

  • Members
  • 86 posts
  •  
    Malaysia

Posted 30 November 2011 - 11:08 PM

There anything wrong with my code? Yeah I'm aware of the "" "".. but it doesn't seem to work with just " " anyway


[main]

Title=PersCustom

Type=script

Author=biatche

Description=Personal Customizations

Selected=True

Level=8

Version=001

[Variables]

[Process]

ExtractFiles,"%ScriptFile%","Folder",netdrive_test.cmd,"%Target_Sys%"

TXTAddLine,%target_sys%winpeshl.ini,""netdrive_test.cmd"",APPEND

[EncodedFolders]

Folder

[Folder]

netdrive_test.cmd=225,300

[EncodedFile-Folder-netdrive_test.cmd]

lines=0

0=eJwli70KwzAQg+cY/A5aAgmE/I0ZSt+iSxfTnFPT1BfiM23fvnYCGqRP0pUeTwZbq5VWh78ZJ84vsLzDk3x4f0EYQcwubduiilvOYx/q/MmzbkVZGjiPamiGZuxrzIxKq8JZ0NcFwW+6H6BYOJ0n8nMKNWgNdHJxb+Io6AQDLj6uudcqqdDq3Gu1mRjoD+XpL114nBPMSy1JKcosS40vSS0u0UvOTWEYBSMIbIbSk3DI91jIFTIwAQDmbAmOELAOiQEAAAACAAAAKwAAAJIAAAAAAAAAAQAAAAAAAAAAAAAA





#6 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 01 December 2011 - 12:43 AM

You can also try something like http://www.paraglide...AddAutoRun.html

#7 RoyM

RoyM

    Frequent Member

  • .script developer
  • 420 posts
  • Interests:"Booting and Owning".
  •  
    United States

Posted 01 December 2011 - 01:24 AM

[main]
Title=PersCustom
Type=script
Author=biatche
Description=Personal Customizations
Selected=True
Level=4
Version=001
[Variables]

[NOTES]
REM YOUR IF EXIST SHOULD CHECK FOR A FILE NOT JUST Y:
@echo off
echo Waiting for network to start... (up to 20s)
for /l %%a in (1,1,20) do (
if exist y:filename.ext (
goto :end
) else (
timeout /t 1 >nul
)
)
:end
Exit 0
pause

REM remove the pause from netdrive_test.cmd
REM winpeshl will hang waiting for the .cmd to exit

[Process]
Require_File,"timeout.exe",%Source_Sys%,%Target_Sys%
Require_File,"timeout.exe.mui","%Source_Sys%%DistLang%","%Target_Sys%%DistLang%"

ExtractAllFiles,"%ScriptFile%","Folder","%Target_Sys%"
//TXTAddLine,%target_sys%winpeshl.ini,""netdrive_test.cmd"",APPEND
TXTAddLine,%target_sys%winpeshl.ini,"#$q%SystemDrive%WindowsSystem32netdrive_test.cmd#$q",APPEND
  • biatche likes this

#8 biatche

biatche

    Member

  • Members
  • 86 posts
  •  
    Malaysia

Posted 01 December 2011 - 06:04 AM

[file copied fine] netdrive_test.cmd exists in system32
[entry added fine] I get %SystemDrive%WindowsSystem32netdrive_test.cmd in winpeshl.ini
[entry line runs fine manually] I copy paste this link and run it to make sure it works, and it runs.
[entry line does not run auto] however, when I boot up, the cmd doesn't show any signs of it having run. (which is the reason for the pause, so that I know the script runs)
im going to have have my batch file echo asdf > %SystemDrive%test.txt to figure out if it runs in background.

I'm actually experimenting each of the methods of executing start up scripts to figure out how they can be used appropriately.

Update: it's definitely not executed.

winpeshl.ini:

[LaunchApps]

"hide /NOCONSOLE /SILENT /WAIT start.cmd"

"Shortcuts.exe -f %SystemDrive%WindowsSystem32Win7PE.cfg"

"PinTool.exe -debug %SystemDrive%WindowsSystem32Win7PE.cfg"

"X:Program FilesPEShellPEShell.exe"

"%SystemDrive%WindowsSystem32netdrive_test.cmd"


winpeshl.log:

Info	  Windows PE Shell beginning execution

Info	  Beginning PNP initialization.

Info	  Winpeshl.ini detected.

Info	  Succeeded launching (null) [hide /NOCONSOLE /SILENT /WAIT start.cmd]

Info	  Succeeded launching (null) [Shortcuts.exe -f X:WindowsSystem32Win7PE.cfg]

Info	  PNP initialization succeeded.

Info	  PNP Initialization thread terminating.

Info	  Succeeded launching (null) [PinTool.exe -debug X:WindowsSystem32Win7PE.cfg]

Info	  Succeeded launching (null) [X:Program FilesPEShellPEShell.exe]


What could be wrong here?

Edited by biatche, 01 December 2011 - 06:23 AM.


#9 RoyM

RoyM

    Frequent Member

  • .script developer
  • 420 posts
  • Interests:"Booting and Owning".
  •  
    United States

Posted 01 December 2011 - 08:01 AM

Try an 8.3 filename for netdrive_test.cmd

something like net_test.cmd

#10 biatche

biatche

    Member

  • Members
  • 86 posts
  •  
    Malaysia

Posted 01 December 2011 - 02:58 PM

I'll give that a try although I don't see why that should help.. since we have "Info Succeeded launching (null) [X:Program FilesPEShellPEShell.exe]"

Perhaps PEShell.exe has to run last? I wonder..

#11 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 01 December 2011 - 04:10 PM

Yes, I think that is the case, since I don't think it ever completes!

So, I would "delete" the peshell line, append your line, and then re-add in the peshell line...

#12 RoyM

RoyM

    Frequent Member

  • .script developer
  • 420 posts
  • Interests:"Booting and Owning".
  •  
    United States

Posted 01 December 2011 - 04:38 PM

TXTReplace,%target_sys%winpeshl.ini,"#$qX:Program FilesPEShellPEShell.exe#$q","#$q%SystemDrive%WindowsSystem32netdrive_test.cmd#$q"
TXTAddLine,%target_sys%winpeshl.ini,"#$qX:Program FilesPEShellPEShell.exe#$q",APPEND

" Perhaps PEShell.exe has to run last? I wonder.. "

Yep, I Shoulda thunked of that.
  • biatche likes this

#13 biatche

biatche

    Member

  • Members
  • 86 posts
  •  
    Malaysia

Posted 01 December 2011 - 05:56 PM

Confirmed working. I really appreciate everyone's help especially RoyM who even has the liberty to help write them. There's no other scene that has as great community as reboot.pro.

Will try the remaining startup methods, should be alright, I don't see much difficulty. With the startup script I should be able to achieve eventually what I need, I don't foresee any trouble, but as for drivers (in my other thread), I'm pretty much clueless still.

BTW, I've been trying to use winbuilder's help (wiki), I can't find certain variables such as %Target_Sys%... Is documentation out of date? There an updated list of variables / commands?

#14 patsch

patsch

    Silver Member

  • Advanced user
  • 785 posts
  •  
    Germany

Posted 01 December 2011 - 06:51 PM

BTW, I've been trying to use winbuilder's help (wiki), I can't find certain variables such as %Target_Sys%... Is documentation out of date? There an updated list of variables / commands?

look into your winbuilder directory ... there you should find the file WinBuilderN.chm as documentation

#15 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 01 December 2011 - 07:02 PM

The "Help" Button in WinBuilder 082's upper left always links to the actual documentation.

Peter

#16 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 02 December 2011 - 09:03 PM

@patsch
Actually, a closer read of his question was *IF* the wiki have any docs on this specific variable.

@biatche
I'm guessing that you have read http://code.google.c...scriptvariables and still have questions. Sadly, the answer (at this time) is only the ones that are defined by the executable are documented. There are many variables like this that are used in the API, but not documented as part of the "API", and yes, that is something we should "fix". These are mostly defined in the script.project file of a given project as "short-hand" by using the existing variables.

For example, in Win7PE_SE, %target_sys%=%TargetDir%WindowsSystem32 (same in MultiPE, and I would guess most other projects)...so, look in the script.project file and you will see a LOT of them and how they are defined using the basic set of things defined by the project.

Thanks for pointing out a "deficiency" in the API docs, since I do know that even in the docs of the API, we make reference to some of this "standard" variables...

#17 homes32

homes32

    Gold Member

  • .script developer
  • 1035 posts
  • Location:Minnesota
  •  
    United States

Posted 02 December 2011 - 09:16 PM

@patsch
Actually, a closer read of his question was *IF* the wiki have any docs on this specific variable.

@biatche
I'm guessing that you have read http://code.google.c...scriptvariables and still have questions. Sadly, the answer (at this time) is only the ones that are defined by the executable are documented. There are many variables like this that are used in the API, but not documented as part of the "API", and yes, that is something we should "fix". These are mostly defined in the script.project file of a given project as "short-hand" by using the existing variables.

For example, in Win7PE_SE, %target_sys%=%TargetDir%WindowsSystem32 (same in MultiPE, and I would guess most other projects)...so, look in the script.project file and you will see a LOT of them and how they are defined using the basic set of things defined by the project.

Thanks for pointing out a "deficiency" in the API docs, since I do know that even in the docs of the API, we make reference to some of this "standard" variables...

its not an API variable. simply a "standard" project variable.
I have begun to document them but haven't uploaded to the wiki yet as it is still in a bit of disarray.

a few common "standard" vars defined by most projects are (values may very between projects but the intent is the same)


%TempFolder%=%ProjectTemp%

%GlobalSupport%=%BaseDir%Workbench  --- used for storing app script settings/downloaded files, etc. common to any project

%ProjectSupport%=%GlobalSupport%%ProjectName% --- used for storing project specific settings during build

%GlobalTemplates%=%GlobalSupport%Common --- used for storing app script settings/downloaded files, etc. common to any project

%RegSystem%=%TargetDir%windowssystem32configsystem -- System Registry hive

%RegSoftware%=%TargetDir%windowssystem32configsoftware -- software registry hive

%RegDefault%=%TargetDir%windowssystem32configdefault -- default (user) registry hive

%RegComponents%=%TargetDir%windowssystem32configCOMPONENTS -- componenst registry hive

%BootSRC%=C:ImagesWin7_32_EN_DVDSOURCESboot_wim2 -- boot.wim source

%InstallSRC%=C:ImagesWin7_32_EN_DVDSOURCESinstall_wim5 -- install.wim source

%Source_Win%=C:ImagesWin7_32_EN_DVDSOURCESinstall_wim5Windows -- source windows directory

%target_win%=%TargetDir%Windows -- target windows directory

%Source_Sys%=C:ImagesWin7_32_EN_DVDSOURCESinstall_wim5WindowsSystem32 -- source system32 directory

%target_sys%=%TargetDir%WindowsSystem32 -- target system32 directory

%TargetProfilesBaseDir%=%TargetDir% -- target "user" directory

%TargetProfilesUserDir%=%TargetProfilesBaseDir%UsersDefault -- target user profile directory

%PECfg%=%TargetDir%windowssystem32Win7PE.cfg -- config file used for shortcuts/autorun, etc. from RAM

%PECfgCD%=%TargetDir%windowssystem32Win7PE.cfg -- config file used for shourctus on cd/usb



#18 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 02 December 2011 - 10:18 PM

its not an API variable. simply a "standard" project variable.
I have begun to document them but haven't uploaded to the wiki yet as it is still in a bit of disarray.

First, thanks for starting to document this, but I would argue that *IF* the API references these variables (just search the WIKI for things like Target_Sys), then they need to be a part of the "API" definition - in other words an API variable in my short-handed way of saying it).

But, the key as you pointed out isn't what we call them, but that they are sort of "required" if you're going to use the API, and need to be defined by the project's code - just as the API functions need to be implemented by a project, even if they choose to do it using their own implementation.

Again, thanks!
:cheers:
Scott

#19 biatche

biatche

    Member

  • Members
  • 86 posts
  •  
    Malaysia

Posted 03 December 2011 - 04:52 AM

Does anybody here use pstart? Using my script here, i have a couple of .exe files copied via ExtractAllFiles,"%ScriptFile%","Folder","%Target_Sys%"

Here's the weird part, running cmd.exe and typing ???.exe it runs fine... where as, running a .cmd FROM pstart .. the file isn't actually found... and %path% are the same!

Clueless, can anybody enlighten me what's going on?

#20 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 03 December 2011 - 10:25 AM

But, the key as you pointed out isn't what we call them, but that they are sort of "required" if you're going to use the API, and need to be defined by the project's code ...

:1st:
The best example comes from the Ice-Age:
The WinBuilder built-in script generator defines

[variables]

%ProgramTitle%=myProgram

%ProgramEXE%=myProgram.exe

%ProgramFolder%=myProgramFolder

These are used by the Ice-Age API to create shortcuts and to unpack attached files.

Peter

#21 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 15 June 2013 - 09:14 AM

TXTAddLine,%target_sys%winpeshl.ini,""netdrive_test.cmd"",APPEND

 

When you want to write quotes into winpeshl.ini, it should be:

TXTAddLine,%target_sys%winpeshl.ini,#$qnetdrive_test.cmd#$q,APPEND

 

Peter



#22 biatche

biatche

    Member

  • Members
  • 86 posts
  •  
    Malaysia

Posted 15 June 2013 - 09:16 AM

this topic is over a year old :/

 

But thanks!



#23 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 15 June 2013 - 09:25 AM

this topic is over a year old :/

 

But thanks!

Question to the forum software:

 

Why did I see it as "unread" ? :hyper:

 

Peter






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users