Jump to content

RunOnce Batch Problem


Recommended Posts

Ok. I've posted a related topic in the nLite section, but this forum seems more appropriote for this specific problem I'm having.

Okay, so I have a batch file on my windows XP cd called start.bat (the path is %SOURCE%\RunOnce\start.bat). Also in this directory is all files necessary for running wget. This batch file makes a directory on the current user's desktop (successfully) and copies all of the wget .exe's and .dll's to the new directory on the desktop. The batch then changes directory to that new directory and runs a single wget command. When the batch file get's this far, it tries to run the wget command, but access is denied. wget.exe cannot write to the new folder.

I figured it was a problem with wget, but then I tried a simple "echo test > test.txt" right before the wget command. Access was denied in the statement too. What it looks like to me is batch files running from a CD do not invoke write priviledges.

Has anyone else has this problem?

Link to comment
Share on other sites

My bad. I guess I just figured this problem was one you could take pretty much out of context. Here's some info.

nLite GuiRunOnce command:


Contents of RunOnce directory:


Contents of start.bat

@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\
:: the following line is where I got the first access denied error...
wget --no-cache --no-clobber --tries 3 --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2008070208 Firefox/3.0.1" "http://somewhere.com/sandbox/winget/build.php"
:: so I tried this line thinking it was a problem with wget, but the following line throws an access denied as well
echo test > test.txt
ren "build.php" "download.bat"


Tell me if you need any more information I can provide you with.

Edited by Yzöwl
as stated in my response
Link to comment
Share on other sites

Try and change the command

cd C:\Documents and Settings\%user%\Desktop\download\


cd /D C:\Documents and Settings\%user%\Desktop\download\

This will also change your driveletter.

Or add

-P "C:\Documents and Settings\%user%\Desktop\download\"

to your wget cmdline. This will download everything to the directory behind "-P".

Hope it'll help.

edit: Changed "-p" to '-P"

Edited by jjvs
Link to comment
Share on other sites

First the good news, I've tried your batch file and it works fine for me based upon %source% being %UserProfile%\Desktop\RunOnce.

I've given your batch file a quick rewrite which also works for me from the same %source%

@Echo off&Setlocal
Set "X_=_X.lst"
(Set Y_=--no-cache --no-clobber --tries 3 --user-agent=^")
Set "Y_=%Y_%Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:"
(Set Y_=%Y_% Gecko/2008070208 Firefox/3.0.1")
(Set Y_=%Y_% "http://somewhere.com/sandbox/winget/build.php")
Echo:Creating an instance of wget on user desktop...
>%X_% (Echo:%~nx0&Echo:%X_%)
Xcopy *.* "%UserProfile%\Desktop\download" /i/exclude:_X.lst&&Del _X.lst
Pushd %UserProfile%\Desktop\download
Wget %Y_%&If Not Errorlevel 1 (Ren "build.php" "download.bat"&Echo:download.bat)

Now the bad news, your download is in fact warez related and as such you are in breach of the rules!

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Create New...