simple service


I have a batch file that I have to run ON the server, in order to compile some code, whenever I change the code.  In order to do this, I have to TS into my W2K server and run the batch file.  Is there any way I can just make my batch file a service or something that I can run remotely?  The batch file has to run from a certain directory on the server, and I don't want to share that directory, so I can't just run the batch from my work station.  It looks like this:

cd "F:\inetpub\wwwroot\services\aspnetstore\Components"
csc /t:library /out:../../../bin/Ccmtees.dll localFilesHere.ext

.. more commands here ...


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
You could use the scheduled tasks control panel and schedule it to run periodically.  A service is typically something that runs all the time.  You want the code CONSTANTLY recompiled?  Doing so might lock the file your trying to program/edit.  I'd say go with the scheduled task.  Run it every 5 minutes if you want, but don't make the batch file a service per se or you may have MANY problems trying to use it.

trevorhartmanAuthor Commented:
as you can probaly tell i don't really know what i'm talking about :)

I only need to compile my code RIGHT after I edit it... So I don't want to make it a service.  I would like to make it into something that I could just run from the commmand line on my workstation.. is there some kind of net start syntax or something that could tell the server to run the batch?
Lee W, MVPTechnology and Business Process AdvisorCommented:
If you really want to make it a service, look into srvany - an NT resource kit utility that I'm all but certain is available/included for Windows 2000.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

trevorhartmanAuthor Commented:
well I don't really want to make it into a service, if that's not the right way to go..  i mean, what do you recommend?  I'm telling you what I need - the ability to run something on the server by typing a command on my workstation..  Does that require making a service, or is there an easier way?
Lee W, MVPTechnology and Business Process AdvisorCommented:
Ok, so you want to edit the program on your workstation, then have your workstation kick off the script on the server so that you don't have to terminal in, right?
Lee W, MVPTechnology and Business Process AdvisorCommented:
Try downloading the free PSTOOLS from  One of the tools included is "PSEXEC" - here's some info about it:

PsExec v1.55 - Execute processes remotely
Copyright (C) 2001-2004 Mark Russinovich
Sysinternals -

PsExec executes a program on a remote system, where remotely executed console
applications execute interactively.

Usage: psexec [\\computer[,computer2[,...] | @file][-u user [-p psswd]][-n s][-s|-e][-i][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,...] cmd [arguments]
     -a         Separate processors on which the application can run with
                commas where 1 is the lowest numbered CPU. For example,
                to run the application on CPU 2 and CPU 4, enter:
                "-a 2,4"
     -c         Copy the specified program to the remote system for
                execution. If you omit this option the application
                must be in the system path on the remote system.
     -d         Don't wait for process to terminate (non-interactive).
     -e         Loads the specified account's profile.
     -f         Copy the specified program even if the file already
                exists on the remote system.
     -i         Run the program so that it interacts with the desktop on the
                remote system.
     -n         Specifies timeout in seconds connecting to remote computers.
     -p         Specifies optional password for user name. If you omit this
                you will be prompted to enter a hidden password.
     -s         Run the remote process in the System account.
     -u         Specifies optional user name for login to remote
     -v         Copy the specified file only if it has a higher version number
                or is newer on than the one on the remote system.
     -w         Set the working directory of the process (relative to
                remote computer).
     -priority      Specifies -low, -belownormal, -abovenormal, -high or
                -realtime to run the process at a different priority.
     computer   Direct PsExec to run the application on the remote
                computer or computers specified. If you omit the computer
                name PsExec runs the application on the local system,
                and if you specify a wildcard (\\*), PsExec runs the
                command on all computers in the current domain.
     @file      PsExec will execute the command on each of the computers listed
                in the file.
     program    Name of application to execute.
     arguments  Arguments to pass (note that file paths must be
                absolute paths on the target system).

You can enclose applications that have spaces in their name with
quotation marks e.g. psexec \\marklap "c:\long name app.exe".
Input is only passed to the remote system when you press the enter
key, and typing Ctrl-C terminates the remote process.

If you omit a user name the process will run in the context of your
account on the remote system, but will not have access to network
resources (because it is impersonating). Specify a valid user name
in the Domain\User syntax if the remote process requires access
to network resources or to run in a different account. Note that
the password is transmitted in clear text to the remote system.

Error codes returned by PsExec are specific to the applications you
execute, not PsExec.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
trevorhartmanAuthor Commented:
looks good, thanks for the reference

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 2000

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.