Topic: Autorun.exe is not executed...  (Read 5888 times)

Autorun.exe is not executed...
« on: May 16, 2013, 07:23:45 PM »

newcoder

  • Jr. Chef
  • **
  • Date Registered: May 2013
  • Posts: 31
Build\9-Autorun is activated in Winbuilder Win7PESE, but it seems to be not executed.

I did only add copying of an ini-file for TotalCommander, pls see third last row:
Code: [Select]
...
[PEX]
If,ExistFile,%target_sys%\autorun.cmd,Begin
  TXTAddLine,%target_sys%\autorun.cmd,"@Echo off",Append
  TXTAddLine,%target_sys%\autorun.cmd,"If Exist #$q#$pSystemDrive#$p\Users\Public\Desktop\desktop.ini#$q del /q /f #$q#$pSystemDrive#$p\Users\Public\Desktop\desktop.ini#$q & del /q /f /A:R /A:H /A:S /A:A #$q#$pSystemDrive#$p\Users\Public\Desktop\desktop.ini#$q",Append
  TXTAddLine,%target_sys%\autorun.cmd,"If Exist #$q#$pSystemDrive#$p\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup#$q Attrib +S +H #$q#$pSystemDrive#$p\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup#$q",Append
  TXTAddLine,%target_sys%\autorun.cmd,"If Exist #$q#$pSystemDrive#$p\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup#$q Attrib +S +H #$q#$pSystemDrive#$p\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup#$q",Append
  TXTAddLine,%target_sys%\autorun.cmd,"drvload.exe #$pSystemRoot#$p\inf\battery.inf",Append
  TXTAddLine,%target_sys%\autorun.cmd,"If Exist #$q#$pPE_Programs#$p\totalcmd_Prg\wincmd.ini#$q copy /Y #$q#$pPE_Programs#$p\totalcmd_Prg\wincmd.ini#$q #$q#$pSystemDrive#$p\Users\Default\AppData\Roaming\GHISLER\#$q",Append
  TXTAddLine,%target_sys%\autorun.cmd,"exit",Append
End
...

Even a StartUP folder is not available in start menu!?

How to fix it?
Thx...

Re: Autorun.exe is not executed...
« Reply #1 on: May 17, 2013, 12:26:45 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
You are on very wrong path newcoder, nothing to fix.

Create a Total Commander plugin,
use "Utils\PC Packed"
and if you want a startup execute, use "Startup option" on "Utils\PC Packed"

to put wincmd.ini to subfolder of appdata, add some codes to this new plugin, check end of this
http://theoven.org/index.php?topic=473.0

+
for drvloader.exe task, do same above, "Utils\PC Packed" -> use "Startup option"
 with a batch like drvloadbattery.cmd
ps: you can also see "test cmd" attachment here reply 4 http://theoven.org/index.php?topic=627.msg8953#msg8953

+
same for desktop.ini delete task ;)

*
or you can sum up all your batch tasks on a single batch as explained above.


Re: Autorun.exe is not executed...
« Reply #2 on: May 17, 2013, 01:24:20 PM »

newcoder

  • Jr. Chef
  • **
  • Date Registered: May 2013
  • Posts: 31
Thanks for help.

It seems to be a misunderstanding:

First:
I do not want totalcmd.exe to be executed at startup, so "Startup option" seems to be not needed !?

Second, regarding ini-file:
I do not want to set ini-path only, but I want to copy a preconfigured wincmd.ini to:
%SystemDrive%\Users\Default\AppData\Roaming\GHISLER\

Preconfigured wincmd.ini is located in totalcmd.7z, with was used for creating the plugin with ..\utils\PC Packed.

How to do so?

+
About ..\Build\9-Autorun script:
The drvloader.exe task has been added from ChrisR (History004)
The desktop.ini delete task has been added from ChrisR (History006)

Re: Autorun.exe is not executed...
« Reply #3 on: May 17, 2013, 04:00:43 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
+
yep, these 2 lines are project specific added by ChrisR I missed  :embarrassed: ,

Still, avoid project specific arrangements  :thumbsup: and as adviced use general syntax.

+
First:
I do not want totalcmd.exe to be executed at startup, so "Startup option" seems to be not needed !?
it is reply to your "autorun not working" ;)
since plugin startup option demonstrates how general syntax Add_Shortcut,Autorun used, it would give you a much better way (modular AND general syntax assures things work in future, autorun is not a general way at all ) for your task.

I readvice you to check test cmd  plugin  :thumbsup: for whatever your execute-bootup task  :great:



+
Second, regarding ini-file:
I do not want to set ini-path only, but I want to copy a preconfigured wincmd.ini to:
%SystemDrive%\Users\Default\AppData\Roaming\GHISLER\
there is no misunderstanding, I showed you how you can put your .ini file to this folder during build time....

Preconfigured wincmd.ini is located in totalcmd.7z, with was used for creating the plugin with ..\utils\PC Packed.

How to do so?
as you may read things at !
http://theoven.org/index.php?topic=473.0
with title: How to put a file to "User Profile" location:

lines there provides you path variable for your .ini folder, writing this to appropriate place to your plugin

IniRead,%ProjectDir%\Script.Project,BasePath,Appdata,%AppData%
Set,%TargetUserAppData%,%TargetProfilesBaseDir%\%AppData%

and adding

Set,%t%,%TargetProfilesBaseDir%\%AppData%\GHISLER

than

If,Not,ExistDir,%t%,DirMake,%t%

and than copy your .ini file

FileCopy,%Target_Prog%\%ProgramFolder\wincmd.ini,%t%


something like that, I am sure you can now figure out easly after some trials


:turtle:

Re: Autorun.exe is not executed...
« Reply #4 on: May 17, 2013, 05:21:21 PM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
Build\9-Autorun is activated in Winbuilder Win7PESE, but it seems to be not executed.
I think it is well executed but I saw quickly that you have used %PE_Programs% in autorun.cmd.
This variable is not defined in WinXpese, It is only used for scripts.

Re: Autorun.exe is not executed...
« Reply #5 on: May 18, 2013, 03:33:42 PM »

newcoder

  • Jr. Chef
  • **
  • Date Registered: May 2013
  • Posts: 31
Ok, thanks for help once more.

I did get it running with inserting the following two lines to autorun.cmd script:
Code: [Select]
If Exist "Y:programs\totalcmd_Prg\wincmd.ini" md "%AppData%\GHISLER\"
If Exist "Y:programs\totalcmd_Prg\wincmd.ini" copy /Y "Y:programs\totalcmd_Prg\wincmd.ini" "%AppData%\GHISLER\"

Next attempt will be inserting the provided lines (@Lancelot) to Totalcmd.script to get it autorun.cmd independend  :cool:.

But: Where to insert in script (which [section] )?

Re: Autorun.exe is not executed...
« Reply #6 on: May 18, 2013, 04:25:39 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Next attempt will be inserting the provided lines (@Lancelot) to Totalcmd.script to get it autorun.cmd independend  :cool:.

But: Where to insert in script (which [section] )?

Since you say you use PC Packed for that:
under [Process] section,
before Add_Shortcut stuff
Quote
//Registry
//--
//Additions
...
...
...

If,%pCheckBox1%,Equal,True,Add_Shortcut,Desktop

tip:
after a build:
there is "green play button" at top of your plugin, where you can test your changes,
 and click "log" button (and when required save as log-view last log) to see how things goes...

:turtle:

Re: Autorun.exe is not executed...
« Reply #7 on: May 19, 2013, 08:31:50 AM »

newcoder

  • Jr. Chef
  • **
  • Date Registered: May 2013
  • Posts: 31
Ok, following the way I did solve my problem:

1. Making a file auto-st.cmd, containing:
Code: [Select]
If Exist "Y:programs\totalcmd_Prg\wincmd.ini" md "%AppData%\GHISLER\"
If Exist "Y:programs\totalcmd_Prg\wincmd.ini" copy /Y "Y:programs\totalcmd_Prg\wincmd.ini" "%AppData%\GHISLER\"

2. Packing it to auto-st.7z

3. In WinBuilder: Making a script with auto-st.cmd, using ..\Utils\PC Packed, option 'Add Startup Optin' enabled.

4. Activating this new script in ..\AppsMy\1Prepare\Auto-st, option 'Startup shortcut' enabled.

It's running with a charme.

Notice:
In auto-st.cmd can be added all commands needed for startup executing.
Thx for help  :great:

Re: Autorun.exe is not executed...
« Reply #8 on: May 19, 2013, 11:01:56 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
reminding above what you did is hardcoded so it may not work on some conditions , I would advice anyone to avoid ......
the path I had written was not hardcoded + avoiding any startup task ...

Following what you prefer:
your startup batch can be written without hardcoded
just add:
cd /d %~dp0
to very top of your batch and get rid of hardcodes,
putting batch to same folder of total commander

something like that
Code: [Select]
cd /d %~dp0
md "%AppData%\GHISLER\"
If NotExist "%AppData%\GHISLER\wincmd.ini" copy /Y "wincmd.ini" "%AppData%\GHISLER\"



Anyway, if things ok for you than ok... but try to avoid hardcodes as habit and try to learn none-hardcoded ways for your future plugins,
 which would improve your plugin writing  :great: and most importantly gain ability to write proper plugins that will always work gaining time....

See you :turtle:
« Last Edit: May 19, 2013, 11:17:38 AM by Lancelot »

Re: Autorun.exe is not executed...
« Reply #9 on: May 19, 2013, 04:47:14 PM »

newcoder

  • Jr. Chef
  • **
  • Date Registered: May 2013
  • Posts: 31
Quote
just add:
cd /d %~dp0
to very top of your batch and get rid of hardcodes,
putting batch to same folder of total commander
Sorry, this hint I do not understand  :confused:

If putting the ini-copy-commands into a batch file, it must be called before executing Totalcmd.exe.
So if putting it to same folder as total commander, which file name and how to activate executing?

How to encode
Code: [Select]
If Exist "Y:\programs\totalcmd_Prg\wincmd.ini"
without hardcoded path for use in cmd-file?
Name of Win-variable for Y:\programs\?

Thx...




Re: Autorun.exe is not executed...
« Reply #10 on: May 19, 2013, 07:08:56 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Sorry, this hint I do not understand  :confused:
Sorry, I do not have very wide time, if I had time probably I would ask your plugin so I could demonstrate ....
 what I would do would be simply copy-paste what I wrote above and test with green button as I had written ....
  but no time.. ---> it is what you should do and practice anyway (tests, emulators, etc... All we learned that way ) ...


So if putting it to same folder as total commander, which file name and how to activate executing?
I wrote all clear as possible, but since you have not learned-practiced plugin writing well yet, nothing to do....
 I also provided you totally 2 ways (1st best, 2nd following you)
  I feel you need to read things (current topic) carelfully, and be stubborn enough to test and figure out  :great: --> which are the roots of learning on all areas.... (which people generally avoid !!!!!)
   after such work, you would figure out "basics", and as a result your questions would be more "task point" short , and replies would be "task point" short .


Keep in mind, we are all none-profit group and these days have quite little time, busy with life things other than pe... up to available time you can help get help from others ....
We wrote and developed lots of stuff (Macro Library, PC Packed, many plugin create helpers, many replies to topics like your topic) , on basic level what you need is simply spend time and work on things .....


Maybe/IF you spend some time, learn, you can write a new bie tutorial-tip topic for things you figure out ( after you FULLY figure out)
 A newly learned individual tip/tutorial is always better than experienced ones like us  :wink:


Good luck on your discovery route, it was fun to me at very past discovering these stuff  :smile:

See You :turtle:

 

Powered by EzPortal