# [wpkg-users] Running Batch file from WPKG

Tomasz Chmielewski mangoo at wpkg.org
Fri Dec 2 22:51:26 CET 2005

Kristofer Kiik schrieb:
> On 11/29/05, Corey Laymon <devlinz34 at gmail.com> wrote:
>
>>I have been using wpkg for the last month now and am really impressed.
>>However, I am experiencing one problem with an install.  I have created a
>>batch file that will provide an xcopy of several files and directories, make
>>a reg entry and map a network resource.  The batch file works fine on its
>>own.  The problem is when I call it from WPKG, the batch starts copying
>>files, but stops after 165 files in one directory.  I cannot figure out how
>>to get it to run the entire batch file xcopy.  I tried running wpkg with the
>>/debug, but it just hangs at running install.bat.  Any help would be
>>appreciated.
>
>
> I have found that to automatically copy a bunch of files to a client,
> make registry changes and so on, the easiest way is to make an install
> package using Innosetup ( http://www.jrsoftware.org/ ). Its a free,
> open source setup package maker. It packs all your files into a tight
> little exe witch can be run interactively or without user interaction.
> Of course, it may not suit your purposes, but thats a much neater
> solution than a bat file.

I think I will use InnoSetup to write an installer (finally?) for WPKG.

I noticed recently that it is possible to start anything as a service
with the use of cygrunsrv from Cygwin - it's a great solution for all
Windows versions (only XP has command-line version of schtasks.exe).

So all that is needed are two additional files: cygrunsrv.exe and
cygwin.dll.

We could launch an installer made with InnoSetup that reads the flags:

Mandatory flags:

--serverpath [\\path\to\wpkg or P:\
wpkg]

Non-mandatory flags:
--pathuser [user to connect to \\path\to\wpkg]
--pathpass [password of the user connecting to \\path\to\wpkg]
--localpath [local installation path; default: %PROGRAMFILES%\wpkg

Installer does the following:
1) creates %PROGRAMFILES\wpkg folder, readable only by SYSTEM and
2) copies cygrunsrv.exe and cygwin.dll to this folder
3) creates a wpkg.bat file, which does:

net use /user:%PATHUSER% %PATHPASS%
%SERVERPATH%\wpkg.js /synchronize /quite
net use /del

4) starts a service using cygrunsrv, which is our batch file.

A good point is that we could use any non-priviliged (we want to use)
user as the credentials to access a share.

To make it even more secure, this batch file should not be in plain - in
case someone steals a hard drive, it would be harder to guess
credentials. But as the credentials are not so sensitive (using Admin
credentials should be discouraged).

It seems that making a batch file "not plain" is not so trivial task :)

However, as I don't have Windows at home, and running it in Qemu was
sooo slow and time consuming, I have to figure out some Windows machine
to play with (probably some Windows machine where I work, but it'd be
hard to connect there right now).

--
Tomek
http://wpkg.org

wpkg-users mailing list
wpkg-users at lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users