Embedding files and using with %MYFILES%

Convert your BATch files into EXEcutable format in one click.
Post Reply
wolfdogg
Posts: 3
Joined: Mon Apr 20, 2009 3:05 pm

Embedding files and using with %MYFILES%

Post by wolfdogg » Mon Apr 20, 2009 3:15 pm

Sorry that I'm probably asking something that's been asked. I really did search, but I'm still confused on how to do this.

I've been using WinRar for a long time to build .exes and send down to laptops for people at work, via a weburl. I'm hoping to replace that process with this to make it a bit more transparent. In my WinRar package, I include osql.exe and updatesql.sql script, as well as the batch file. My batch file simply calls osql and sql script in the same line.

I'm totally confused on how to use the %MYFILES% paramater or if I can for this. I can write my simple little batch file, as I've currently been using it:

Code: Select all

@echo off
echo updating laptop database...
osql -ddatabasename -Uuser -Ppassword -iupdatesql.sql -n
echo.
pause
I try to add the %MYFILES% option:

Code: Select all

@echo off
echo updating laptop database...
CALL %MYFILES%\updatesql.sql
CALL %MYFILES%\osql.exe
osql -ddatabasename -Uuser -Ppassword -iupdatesql.sql -n
echo.
pause
At this point, is it possible to include osql.exe and updatesql.sql and make them run via the embedded files tab or do these files need to already reside on the laptops? How do I call them?

It might not be possible to do this in this way.. but just wanting to make sure it's not something I'm doing wrong before giving up.

Thank you!

wolfdogg
Posts: 3
Joined: Mon Apr 20, 2009 3:05 pm

Got it!

Post by wolfdogg » Mon Apr 20, 2009 7:18 pm

Nevermind.. figured it out. I was making it too hard. %MYFILES% is not documented well anywhere, but once I figured it out, it was quite easy. No need to have a separate call to osql. All I did was attach my sql script in the 'Embedded Files' tab and put the following source code in for the batch file:

Code: Select all

@echo off
echo updating laptop database...
osql -ddatabasename -Uuser -Ppassword -i%MYFILES%\updatesql.sql -n
echo.
echo If the above shows (1 row affected) and there are no errors reported, the update was successful.  You may exit this program.
pause
Runs great.. just a console window showing and everything else in the background as I wanted... in case anyone else needs the help. :)

Peace!

Post Reply