Topic: Autorun.cmd and Add_Shortcut,"Startup"  (Read 5393 times)

0 Members and 1 Guest are viewing this topic.

Autorun.cmd and Add_Shortcut,"Startup"
« on: May 15, 2013, 05:45:02 PM »

0scar

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2013
  • Posts: 179
@ChrisR
As the old usefull  Add_Shortcut,"Startup"... creates a shortcut in the Startup folder but it is not processed by win7/8pe_SE may you think adding by default as the last line of autorun.cmd the following:

FOR  %%F IN ("%systemdrive%\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\*") DO "%%F"

In this way any *.lnk in the Startup folder would be executed, also autorun.cmd should be Mandatory=True like most scripts in the same group.

Regards

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #1 on: May 15, 2013, 09:51:10 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7076
@0scar

if not processed by Win7/8PE SE , there is a bug, since on Win7/8PE SE startup shortcuts created with Add_Shortcut,AutoRun processed (executed) by its own bootup loader (I guess shortcuts.exe) . Shortly what you suggest with a batch should be already there so no need batch.  :wink:

Are you sure there is a bug ?? if so can you give detail what you've done ????

Aside, If you (or anyone) one day figure out why Win7/8PE SE Explorer shell do not process startup shortcuts, it would be a nice valuable info  :smile:

autorun.cmd no need to be Mandatory=True , it is there to serve-help old pebuilder users make transfer easier. (like your case) Same plugin also compatible to Gena aside it even not exists on Gena distribution since no need to  :wink:

ps: As we are both old pebuilder users, we both know autorun created as an addon to nushell to have startup available which nushell did not have, but on current projects there is no such trouble with  Add_Shortcut,AutoRun at hand....

 Add_Shortcut,AutoRun should result same for anyone and fit %99 cases unless there is a special-project specific "order" case. I advice you to transfer your autorun batches to Add_Shortcut,AutoRun in time. Who knows maybe one day this plugin default Selected=False in future...
  Tip: "Plugin Creator Packed" have "Add Startup option" even with a "hide" sub option (hide option more usable for startup batches ;))

An additional info:
You can find a complete startup executer batch inside
\Yomi-Gena\Shell\"PE Shell Swapper"
with name PEShellStartup.cmd
Since on Gena we do not have a custom bootup loader, I had made this batch for shells other than Explorer on Gena   :wink:

:turtle:
« Last Edit: May 15, 2013, 09:56:51 PM by Lancelot »

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #2 on: May 16, 2013, 04:37:24 AM »

0scar

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2013
  • Posts: 179
Yes, I have read that is an old bug, and in the Winbuilder help the Startup option for Add_Shortcut, StartUp  is not more documented, so I assume  nobody could  fix it. But the other options AutoStart AutoRun also do not work for me.

This is what a have done, the only method that works is TXTAddline... in autorun.cmd:

Add_Shortcut,"Startup",,"%Systemdrive%\Program Files\HWinfo32\HWinfo32.exe", "HWinfo32" <<<<< DO NOT Work

Add_Shortcut,"AutoStart","","%Systemroot%\media\chimes.wav","chimes"  <<<< NO

Add_Shortcut,"AutoRun","","%Systemroot%\media\tada.wav","tada" <<<<< NO

Add_Shortcut,"StartUp","","%Systemroot%\media\ringout.wav","ring" <<<<< NO

AddPostConfig,"chimes","%Systemroot%\media\chimes.wav",,3 <<<<<< NO

AddPostConfig,"notify","x:"\program files\windows media player\wmplayer.exe"," #$q#$pSystemRoot#$p\Media\notify.wav#$q  /close /minimized",3 <<<<< NO

Add_Shortcut,"StartUp",,"x:\program files\windows media player\wmplayer.exe ","tada",,#$q#$pSystemRoot#$p\Media\tada.wav#$q  /close /minimized <<<<<< NO

TXTAddLine,%target_sys%\autorun.cmd,"x:"\program files\windows media player\wmplayer.exe" #$q#$pSystemRoot#$p\Media\tada.wav#$q  /close /minimized",Append <<<<< YES

TXTAddLine,%target_sys%\autorun.cmd,"%Systemroot%\media\tada.wav",Append <<<<<< YES

BTW, Why Have you used this method in Audio.script instead of Add_shortcut,Autosomething?:

TXTAddLine,%target_sys%\autorun.cmd,"Hiderun.exe madplay.exe -Q #$q#$pSystemRoot#$p\Media\%Sound_FileName%#$q",Append  <<<< YES

TXTAddline works only if Autorun.script is enabled and it may be disabled. An alternative is to use Depends=Autorun.script


I have written a 3-Add_Shorcut,StartUp fix.script Level=8 Finals as a workaround
to launch the shortcuts in the Startup folder created by the buggy Add_Shorcut,StartUp
 
[Process]
If,ExistFile,%TargetDir%\windows\system32\autorun.cmd,begin
TXTDelLine,%TargetDir%\windows\system32\autorun.cmd,exit
TXTAddLine,%target_sys%\autorun.cmd,"FOR  %%F IN ("X:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\*") DO "%%F" ",Append
TXTAddLine,%TargetDir%\windows\system32\autorun.cmd,"exit",Append
End

Cheers


Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #3 on: May 16, 2013, 06:25:56 AM »

ChrisR

  • Moderator, Win7PE SE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 2809
In WinXpese AutoRun (or Autostart) is launched by shortcuts.exe and before shell explorer.
It is not surprising, indeed, that your examples does not work, with Hwinfo32, song (the service is not yet started).

Currently, I do this kind of thing in autorun.cmd or with RunOnce but not with the startup folder that I voluntarily hidden.

The Startup folder is not really a bug, we can add shortcuts or programs inside without worries.
but for now, I have not seen any PE2,3 or 4 where apps, lnk or others of these folders are started in automatic, in native as in real windows.
So, yes, it can be an additional startup option.

Yomi CmdStartup.cmd is well for this task, with folders retreived from the registry, Start /D and apps moved after launch.
CmdStartup.cmd can be launched from the autorun script, which should be mandatory as for autorun.cmd.

:cheers:

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #4 on: May 16, 2013, 06:43:25 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7076
I feel your workaround only helps the delay to get audio working as Chris indicated..

before concluding to your "workaround" test this:
* Test CMD.7z (6.06 kB - downloaded 221 times.)
and see if batch open at boot ????
( also make a test 2 with "run from ram" option)
If not, there is definately a bug  :wink: (I do not think but who knows...)
 If yes, let us know :turtle: --> means Add_Shortcut,Autorun working  :cool:


Repointing: As an end user, Avoid using autorun.cmd when possible (which %99 no normal plugin needs ;)), play with PC Packed and check existing simple apps plugins.




@Chris
I feel:
[autorun] staff after executing, in addition .lnk created to Startup folder (If Startup folder exist*) to avoid "confusion" of not having them, instead of totally hiding Startup folder as default. ( aside 0scar never wrote how he put .lnk file there, I assume manually !)
 I know these .lnk s not processed ;) but at least this will avoid confusion of Add_Shortcut,Autorun not working ..รงรง

If Startup folder exist* --> still keeping option "delete Startup folder" (unselected as default this time) for the ones who like to get rid of folder  :wink: ( which will avoid .lnk creation automatically as pointed above ;))

:turtle:
« Last Edit: May 16, 2013, 07:08:36 AM by Lancelot »

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #5 on: May 16, 2013, 09:09:21 AM »

0scar

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2013
  • Posts: 179

I aside 0scar never wrote how he put .lnk file there, I assume manually !)
 
:turtle:

I have said how: using lines like this  Add_Shortcut,"Startup",,"%Systemdrive%\Program Files\HWinfo32\HWinfo32.exe", "HWinfo32" puts correctly the *.lnk in the Startup folder but then they are not processed, which is a pity. The workaround is for forcing running the shortcuts which are in there "natural" place, specially for people who does not remember that those shortcuts will not be executed.

Later I will try with your test.

Thanks
« Last Edit: May 16, 2013, 09:10:40 AM by 0scar »

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #6 on: May 16, 2013, 02:18:11 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7076

I aside 0scar never wrote how he put .lnk file there, I assume manually !)
 
:turtle:

I have said how: using lines like this  Add_Shortcut,"Startup",,"%Systemdrive%\Program Files\HWinfo32\HWinfo32.exe", "HWinfo32" puts correctly the *.lnk in the Startup folder but then they are not processed, which is a pity.


now I understand what you did,
it is very pity you trying to do something that is not meant to be, by ignoring what was written - instruction - info (reply 1),
 which was already proven working with a provided test plugin made after your ignorance to reply 1  (reply 4)
  and well explained reason behind at reply 1-3 ...

Well,  sure you can go from point A to B directly if you follow what is replied to you,
 or decide to workaround with an undirect route A-C-B ,
  which probably will not work (as warned on previous replies) after updates in time that will require another workaround that time to A-C-D-B ...
    no need to mention bad example usages of hardcoded paths, where I remember I warned you to check other simple plugins or Plugin Creator results.....

It is your decision to make things complicated (+time consuming, +harder to maintain) for you by not following advices - replies - test that are given, well decision is decision. Still quite pity but this is life.
 :turtle:
« Last Edit: May 16, 2013, 02:18:39 PM by Lancelot »

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #7 on: May 16, 2013, 02:58:46 PM »

0scar

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2013
  • Posts: 179
Hi Lancelot, your test shows the DOS box once before de desktop, it puts a shortcut on the desktop and here:

"X:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Win7PE_SE\Projects\Win7PESE\0scars\Others\Test CMD.lnk"

What is in red is the path of your script in my HD C:

 

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #8 on: May 16, 2013, 10:14:56 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7076
Hi Lancelot, your test shows the DOS box once before de desktop,

gut, as you may already notice Add_Shortcut,AutoRun line inside plugin working A-->B so no need C  .. shortly what you ask is already achived and working  :great:


it puts a shortcut on the desktop and here:


"X:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Win7PE_SE\Projects\Win7PESE\0scars\Others\Test CMD.lnk"

What is in red is the path of your script in my HD C:

on plugin interface there is "Start Menu folder" box where you can change this (red)


Tip:
you may notice all apps plugins distributed around have empty "Start Menu" folder box, and do not give your red result,
 there is an automatic routine that follows sub-folder name under \Apps\
  idea is avoiding filling / changing "Start Menu folder" box for Apps plugins ..
Since you use a folder out of apps, automatic routine take your path name
 If you had opened a folder under Apps\Oscar\Others it would be Oscar\Others

Tip:
for stable usages of your additional plugins, use a out of project folder like MyScripts ,
 http://theoven.org/index.php?topic=193.0
  (or maybe you prefer Oscar ;) by small modifications)
  which gives seperate folder out of project folder,
   which ease and secure your personal plugins (example: you can delete project folder quickly and put a fresh one without worrying, knowing your personal plugins are out --> which is critical since projects are dynamically updated after some months this is what most do)

Well, If you use (Adviced) a subfolder under MyScripts with Apps folder (example: MyScripts\Apps\Oscar --> and adding plugins here like Test cmd)  empty box will automatically will give you
"X:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Oscar\Test CMD.lnk"


REreminding (Warning) (Attention): for tests it is quick and nice using project sub-folders, other than that keep your plugins out of project folder

:turtle:

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #9 on: May 17, 2013, 03:43:42 AM »

0scar

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2013
  • Posts: 179

gut, as you may already notice Add_Shortcut,AutoRun line inside plugin working A-->B so no need C  .. shortly what you ask is already achived and working  :great:




Add_Shortcut,AutoRun runs too early, actually what I want is to play a sound  or run a *.cmd at the absolute end of all the things win7pe do before transferring the control to the guy seated at the keyboard.
Is it possible to achieve my goal using something different from the last line in autorun.cmd?

Regards

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #10 on: May 17, 2013, 05:41:49 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7076
sadly there is no absolute end guarentee since we can not know how things change in future
 ex: current audio plugin provides 2 startup option, one with autorun.cmd (current) other with winxpe.cfg (Startup), future unknown ??!!
  pe startup procedure order is quite a pain in ass during development in time ;) (either project development or new projects of future...)
   only project plugins can be updated by project admins for right order with changing conditions... That is the reason project ideas-plugins willingly added to projects to get features-plugins keep working, leaving other tweaks-apps things to end user or to low priority....

lessons from pebuilder development:
 bart made core build, sherpya made features that creates mostly full xp,
  others made additions in time,
   but things change in time where things need to be updated on both bart core and sherpya......
    later everybody did his/her best to catch changes....
     trouble behind was things being quite splitted .....
--> here on all projects development : "bart+sherpya+time changes (which not only includes updates but also new core features + plugins) "=main core stuff ,
  all gathered inside projects,
   so end user can more easly focus on personal plugins using standart syntaxes-ways to assure future working conditions, and updates can be made on core stuff easly.
    (ex: sherpya do not have theme feature since not working, but in time JFX figure out how to get Theme work hence we added this project specific feature to Gena, which undergo a few more enhancements in time..) . ( ex2: very recently aeolis and 2aCD works on IE added to Win8PE SE following enhancements )





so whatever you goal, if possible for general usage, better implemented to audio plugin to be sure it will work always in future  :thumbsup:

ex:  like ChrisR adding startup wav option ;)

------> maybe ChrisR can include a SoundAfter option with a box (or batch option..), so you can include your line(s) (batch) to box as the last thing to be processed  :smile: (not modular as a seperate plugin but good enough if you take down your notes on your seperate plugin ;))
Thinking Twice:
adding "Execute AfterAudioDrvload.cmd" checkbox seem (default true) to me simplest way ;) so one can add all afteraudio tasks to single AfterAudioDrvload.cmd with a seperate plugin  :wink:





In addition, When order is trouble, General option at hand is:

using sleep.exe with a startup batch like on test cmd plugin
http://theoven.org/index.php?topic=52
idea is simply adding a delay ;)

an example usage is at Gena\Apps\Network\Remote Connect\"VNC Real" plugin
which waits network be ready before starting vnc server, works as a general solution
 (ps: one pe currently starting network can be done either via penetwork or native network or who nows maybe other utilities in future ....)

relevant lines for extraction
Code: [Select]
ExtractFile,%scriptfile%,Folder,sleep.7z,%Target_Prog%\%ProgramFolder%
ShellExecute,Hide,%Tools%\7z.exe,"e #$q%Target_Prog%\%ProgramFolder%\sleep.7z#$q -y -o#$q%Target_Prog%\%ProgramFolder%#$q Sleep\sleep-%SourceArch%.exe"
FileRename,%Target_Prog%\%ProgramFolder%\sleep-%SourceArch%.exe,%Target_Prog%\%ProgramFolder%\sleep.exe
Shellexecute,Hide,cmd.exe,"/C del /q /f sleep.7z",%Target_Prog%\%ProgramFolder%
If,ExistFile,%Target_Prog%\%ProgramFolder%\sleep.7z,Call,FileDelete,%Target_Prog%\%ProgramFolder%\sleep.7z

since we implement sleep to vnc server plugin, we never need to update that plugin again  :wink:

ps: on network case for general solution, a check routine (like with ping) can be for delay too since services (on this case network service) starting does not mean network ready to use. (maybe on audio case too ;))

tip: using "hide" option when creating a plugin with "PC Packed" is more suitable for startup batches, avoiding batches seen ;)

ps: penetwork plugin have penetwork_after.cmd option working as described above.

:)  as you notice we had this order trouble with penetwork before  :wink: but with audio you are first I guess (or second assuming startup sound feature added probably by someone who asked before (says my memory))  :great:
:turtle:







**
As you see yours (after audio..) is a special case,
other times always use
Add_Shortcut,AutoRun
:turtle:

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #11 on: May 17, 2013, 08:12:50 AM »

0scar

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2013
  • Posts: 179
O.K.
Thanks for your time.  :smile:

Re: Autorun.cmd and Add_Shortcut,"Startup"
« Reply #12 on: June 25, 2017, 03:13:22 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7076
Just an update about this topic,

http://theoven.org/index.php?topic=2116.msg23553#msg23553

Hi Tony4219, kckennedy

Utils\PC Packed (Plugin Creator Packed)

have delay option for a while.
Reply 75 - Feb 12 2017 - http://theoven.org/index.php?topic=178.msg22839#msg22839


Utils\PC Packed
-> Hit Options Button
-> Enable "Add Startup Option"
----> Enable "Delay"
1) .....
2) .....
3) Gooo


=====>
This will create a plugin without messing with codes,
 with "Startup" and "Delay" options,
  which together are most useful for post penetwork things.

:turtle:


:turtle:

 

Powered by EzPortal