Jump to content

Interesting RunOnce Idea


mecablaze

Recommended Posts

Okay. So I'm pretty new to using nLite (thought I have used it for a while just to integrate hard drive controller drivers). I have never used the RunOnce option in the 'Unattended' page. I want RunOnce to run a single batch script. This batch script will wget (http://www.gnu.org/software/wget/) a PHP script I have on my server. This PHP script will generate another batch script which will request a series of useful programs, also using wget. These packages include Firefox, Thunderbird, K-Lite, Notepad++, etc. Don't worry about the logistics of getting the installer for all of these programs. I had to go through a fun time of screen scraping and other crap in PHP. My question for you guys is where I would put an initial batch script and wget in the Windows XP folder before letting nLite dump the entire folder into an ISO. Also what RunOnce commands would I use.

Confused? Here's another break-down. Right now, on my desktop I have a folder with a batch script, called start.bat, and all of the necessary exe's and dll's for wget. If I run the batch script, wget is copies to the to the current user's desktop, another batch script is downloaded from my server and then run... I feel like anyone who reads this will be confused.

Maybe this will help. Here's the source for my main batch script.

@echo off
for /f "tokens=3 delims=\" %%i in ("%USERPROFILE%") do (set user=%%i) 2>&1

echo Creating an instance of wget on user desktop...
@mkdir "C:\Documents and Settings\%user%\Desktop\download"
@copy libeay32.dll "C:\Documents and Settings\%user%\Desktop\download\libeay32.dll"
@copy msvcr71.dll "C:\Documents and Settings\%user%\Desktop\download\msvcr71.dll"
@copy msvcr80.dll "C:\Documents and Settings\%user%\Desktop\download\msvcr80.dll"
@copy openssl.exe "C:\Documents and Settings\%user%\Desktop\download\openssl.exe"
@copy ssleay32.dll "C:\Documents and Settings\%user%\Desktop\download\ssleay32.dll"
@copy wget.exe "C:\Documents and Settings\%user%\Desktop\download\wget.exe"

cd C:\Documents and Settings\%user%\Desktop\download\
wget --no-cache --no-clobber --tries 3 --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1" ****************/winget/get_installers.php?build=true
ren "get_installers.php@build=true" "download.bat"

download.bat

The six copy statements make a copy of wget to the current user's desktop.

If anyone wants help me out with this project or is interested in the concept, please email me at wintallo@gmail.com.

EDIT: by the way, if anyone would like to see my script in action, message me.

Thanks!

Edited by mecablaze
Link to comment
Share on other sites


Good presentation, tho you kind of mixed question in it, therefore it gets confusing.

Could you please rephrase question into a single, standalone sentence?

to make the batch file run just call it from guirunonce section inside Nlite, f.ex cmd /R pathtofileyourbatchfile.bat

in windows install cd folder that would translate to %source%\batchfiles\yourbatchfile.bat (example) (%source% nlite makes for you, if not using nlite read up on msfn's guide to unattended for other alternatives)

Link to comment
Share on other sites

I notice you use wget... I wasn't aware that windows had wget, and it's a linux/unix feature that I've always wanted. Did you find it somewhere or write it yourself? And either way, could you link me to it? Thanks! :)

You can try http://www.christopherlewis.com/WGet/WGetFiles.htm (linked from the wget wiki which is linked from the wget home page - not that hard to find)

Link to comment
Share on other sites

I have another problem. I get an access denied error when excecuting wget (which was copied from the cd to the desktop) from a batch on the cd.

For the sake of simplicity, I have a batch file on my cd and I want that batch file to create a file on the current user's desktop holding the text "test". This is the command I am using right now.

for /f "tokens=3 delims=\" %%i in ("%USERPROFILE%") do (set user=%%i) 2>&1
cd C:\Documents and Settings\%user%\Desktop\
echo test > test.txt

This code does not work. It gives me an "access is denied" error. Is there a way to enable cd batch scripts to write to the hard drive. Note: I can copy files from the cd to the hard drive. This does not solve my problem because I need a program to write to the hard drive from the batch on the cd.

Thanks for the help so far!

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...