Jump to content

Would this work? Using cleanup.bat as similar to runonceex


Recommended Posts

OK this is what i would like to do and why: i would like to be able to import all my "Favorites" boomarks/internet links to a fresh install of XP. i've used winrar to make a self extracting file that would automatically and silently import all my bookmarks to where my favorites is located. i've tested it and it works. however, i've learned that the User profile isn't created during runoneceex but after. so will i be able to "hijack" the cleanup.bat which i use to delete temp directories and icons to run this rar file assuming it's come after runonenceex?

Link to comment
Share on other sites


you can try by two way by registry or winnt.sif just go to winnt.sif at last type

command9=your file location\cleanup.bat

or try from registry import expandable string value (it can use %systemroot%) to HKLM\softwares\microsoft\windows\current version\runonce

make .reg file and copy it to %OEM% and make textdocument named as cmdlines.txt edit it and type

[Commands]

"regedit /s .reg file"

for more help check google

Link to comment
Share on other sites

That's not what i was asking. i want to know if i can use cleanup.bat (which i use as to delete temp installation directories and remove icons from the desktop) to run an SFX'd winrar file.

Link to comment
Share on other sites

ok here is some thing that may help you

i am using nlite and unattended windowscd creator to slipstream win xp to clean temp and deleting some files i am using RunOnceEx.js my winnt.sif contain

[GuiRunOnce]

wucdcreator="wscript.exe %systemroot%\RunOnceEx.js"

in RunOnceEx.js i had many thing but at last i had clean up.bat which cleans temporary files from window ..

here is my RunOncEx.js

------------------------------------------------------------------------------------------------------

//003

var soft = new Array();

var key = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\";

var runonceex_js = "HKLM\\SOFTWARE\\RunOnceEx.js";

var WshShell = new ActiveXObject("WScript.Shell");

var fso = new ActiveXObject( "Scripting.FileSystemObject" );

var n = 0;

soft.title = "Set Up Software";

soft.insertNextMedium = "Please insert next disk with {soft}";

soft.rebootMessage = "Clean & Reboot";

soft.startReboot = "reboot.exe /t 60 /m \"{message}\" /r {runat}";

soft[n] = new Array();

soft[n].name = "Winamp 5.8";

soft[n].checkPoint = "Software\\Winamp5.8";

soft[n][0] = "\"%CDROM%\\Software\\Winamp5.8\\winamp.exe\"";

n++;

soft[n] = new Array();

soft[n].name = "Reg Tweaks";

soft[n].checkPoint = "Software\\Reg Tweaks";

soft[n][0] = "Regedit /s\"%CDROM%\\Software\\Reg Tweaks\\Tweaks.reg\"";

n++;

soft[n] = new Array();

soft[n].name = "Skins for Winamp";

soft[n].checkPoint = "Software\\Skins for Winamp";

soft[n][0] = "\"%CDROM%\\Software\\Skins for Winamp\\Skins.exe\"";

n++;

soft[n] = new Array();

soft[n].name = "Removing any Temporary file used";

soft[n].checkPoint = "Software\\empty temp";

soft[n][0] = "\"%CDROM%\\Software\\Clean up\\cleanup.cmd\"";

n++;

soft.startReboot = soft.startReboot.replace("{message}", soft.rebootMessage);

//soft.insertNextMedium = soft.insertNextMedium.replace( "{soft}", soft[a].name );

function FindDriveLetter( dir )

{

var e = new Enumerator( fso.Drives );

var x;

var letters = new Array();

var path;

for( ; !e.atEnd(); e.moveNext() )

{

x = e.item();

if( x.DriveType == 3 || x.IsReady )

{

letters = letters.concat( x.DriveLetter );

}

}

if( dir.length == 0)

{

return letters[0] + ":";

}

for( i = 0; i < letters.length; i++ )

{

if(dir.substr(0, 2) != "\\\\")

path = letters + ":\\" + dir;

if( fso.FolderExists( path ) || fso.FileExists( path ) )

{

return letters + ":";

}

}

return "";

}

function GetFilledString( zahl, fillChar, num_of_digits )

{

var filledStr = zahl.toString();

while( filledStr.length < num_of_digits )

{

filledStr = fillChar + filledStr;

}

return filledStr;

}

function RunOnceEx(index)

{

WshShell.RegWrite( key + "TITLE", soft.title, "REG_SZ" );

var netzwerk_install;

for( a = index; a < soft.length; a++ )

{

if( soft[a].name == "-= REBOOT =-" )

{

WshShell.RegWrite( key + GetFilledString(a, "0", 3) + "\\", soft.rebootMessage, "REG_SZ" );

WshShell.RegWrite( key + "TITLE",

soft.title + " " + (index+1).toString() + " - " + (a+1).toString() + " / " + soft.length.toString(),

"REG_SZ" );

WshShell.Run( "rundll32.exe iernonce.dll,RunOnceExProcess", 1, true );

soft.startReboot = soft.startReboot.replace("{runat}", (a + 1).toString());

WshShell.Run( soft.startReboot );

return ++a;

}

else

{

soft[a].drive = "";

if( soft[a].checkPoint.substr(0, 2) != "\\\\")

{

soft[a].drive = FindDriveLetter( soft[a].checkPoint );

netzwerk_install = 0;

}

else

netzwerk_install = 1;

if( soft[a].drive.length == 0 && netzwerk_install == 0 )

{

WshShell.RegWrite( key + "TITLE",

soft.title + " " + (index+1).toString() + " - " + a.toString() + " / " + soft.length.toString(),

"REG_SZ" );

WshShell.Run("rundll32.exe iernonce.dll,RunOnceExProcess", 1, true);

soft[a].drive = FindDriveLetter( soft[a].checkPoint );

}

if( soft[a].drive.length == 0 && netzwerk_install == 0 )

{

WshShell.Popup( soft.insertNextMedium.replace( "{soft}", soft[a].name ), 60, "", 64 );

soft[a].drive = FindDriveLetter( soft[a].checkPoint );

}

if( soft[a].drive.length == 0 && netzwerk_install == 0 )

{

WshShell.Popup( soft.insertNextMedium.replace( "{soft}", soft[a].name ), 60, "", 64 );

soft[a].drive = FindDriveLetter( soft[a].checkPoint );

}

if( soft[a].drive.length == 0 && netzwerk_install == 0 )

{

WScript.Echo( soft.insertNextMedium.replace( "{soft}", soft[a].name ) );

soft[a].drive = FindDriveLetter( soft[a].checkPoint );

index = a+1;

}

if(soft[a].drive.length || netzwerk_install == 1 )

{

WshShell.RegWrite( key + GetFilledString(a, "0", 3) + "\\", soft[a].name, "REG_SZ" );

for(b = 0; b < soft[a].length; b++)

{

if( netzwerk_install == 0 )

soft[a] = soft[a].replace( "%CDROM%", soft[a].drive );

else

soft[a] = soft[a].replace( "%CDROM%", "" );

WshShell.RegWrite( key + GetFilledString( a, "0", 3 ) + "\\" + GetFilledString( b, "0", 2 ),

soft[a], "REG_SZ" );

}

}

}

}

if( index > 0 && index < soft.length )

{

WshShell.RegWrite( key + "TITLE",

soft.title + " " + ( index + 1 ).toString() + " - " + soft.length.toString() + " / " + soft.length.toString(),

"REG_SZ" );

}

if( index < soft.length )

{

WshShell.Run( "rundll32.exe iernonce.dll,RunOnceExProcess", 1, true );

}

return soft.length;

}

function main()

{

//var namedArgs = WScript.Arguments.Named;

//var nextaction = WshShell.RegRead( runonceex_js + "\\" );

var startAt = 0;

//var wait_sek = 0;

var WshSysEnv = WshShell.Environment( "SYSTEM" );

var driversDir = WshSysEnv( "systemdrive" );

driversDir += "\\Drivers";

try

{

startAt = WshShell.RegRead( runonceex_js + "\\runat" );

WshShell.RegDelete( runonceex_js + "\\runat" );

}

catch(e){}

if( RunOnceEx( startAt ) == soft.length )

{

if( fso.FolderExists( driversDir ) )

{

fso.DeleteFolder( driversDir, true );

}

try

{

WshShell.RegDelete( runonceex_js );

}

catch(e){}

}

}

main();

------------------------------------------------------------------------------------------------------------

at last copy this and make .js file and modify or use unattend windows cd creator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...