Raja Sekhar | 2 Aug 2007 06:36
Picon
Favicon

batchfile as service

Hi,
I wanted to run a batchfile as service and added it using instsrv.exe but am getting error 

The service is not responding to the control function.

More help is available by typing NET HELPMSG 2186.

 
for example if the batchfile is something like this and i run this from cmd prompt it runs fine and if i add it to
the services i get error, any workaround for this as i have a program which runs in foreground and want it to
be run from services.when checked Programs like apache.exe runs fine when used in this proceedure 

 <at> echo off 
echo ping localhost -t > work.bat 
start /min work.bat

Thanks,
Raja Sekhar

       
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.

[Non-text portions of this message have been removed]

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@... 
(Continue reading)

foxidrive | 2 Aug 2007 08:39

Re: batchfile as service

On Wed, 1 Aug 2007 21:36:43 -0700 (PDT), Raja Sekhar <rajasn@...>
wrote:

>I wanted to run a batchfile as service and added it using instsrv.exe but am getting error 

This page says it does not work for batch files.

http://support.microsoft.com/kb/137890

"SUMMARY
The Windows NT Resource Kit provides two utilities that allow you to create
a Windows NT user-defined service for Windows NT applications and some
16-bit applications (but not for batch files)."

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@... 
Raja Sekhar | 2 Aug 2007 13:51
Picon
Favicon

Re: batchfile as service

If we add the below mentioned batfile it is running fine.We can install this bat file as service and then
start the service , no error

 <at> echo off
c:\apache\bin\apache.exe "-k -runservice" 

  ----- Original Message ----- 
  From:   foxidrive 
  To: batchworld@... 
  Sent: Thursday, August 02, 2007 12:09   PM
  Subject: Re: [BATCH WORLD] batchfile as   service

        
On Wed, 1 Aug 2007 21:36:43 -0700 (PDT), Raja Sekhar <rajasn@...>
wrote:

>I   wanted to run a batchfile as service and added it using instsrv.exe but am   getting error 

This page says it does not work for batch   files.

http://support.microsoft.com/kb/137890

"SUMMARY
The   Windows NT Resource Kit provides two utilities that allow you to create
a   Windows NT user-defined service for Windows NT applications and some
16-bit   applications (but not for batch files)."

   #ygrp-mlmsg {	FONT-SIZE: small; FONT-FAMILY: arial,helvetica,clean,sans-serif}#ygrp-mlmsg TABLE
{	}#ygrp-mlmsg SELECT {	FONT: 99% arial,helvetica,clean,sans-serif}INPUT {	FONT: 99%
arial,helvetica,clean,sans-serif}TEXTAREA {	FONT: 99%
(Continue reading)

foxidrive | 2 Aug 2007 14:48

Re: batchfile as service


As I see it that batch file adds apache as a service itself.  It doesn't
need instsrv.exe to do it.

What are you trying to achieve?  Your example bat file redirected the ping
output to a temp bat file and then launched the batch file.  What did you
expect that to do?

>>>  <at> echo off 
>>> echo ping localhost -t > work.bat 
>>> start /min work.bat

On Thu, 2 Aug 2007 04:51:52 -0700 (PDT), Raja Sekhar <rajasn@...>
wrote:

>If we add the below mentioned batfile it is running fine.We can install this bat file as service and then
start the service , no error
> 
> <at> echo off
>c:\apache\bin\apache.exe "-k -runservice" 
> 
>  ----- Original Message ----- 
>  From:   foxidrive 
>  To: batchworld@... 
>  Sent: Thursday, August 02, 2007 12:09   PM
>  Subject: Re: [BATCH WORLD] batchfile as   service
>  
>
>        
>On Wed, 1 Aug 2007 21:36:43 -0700 (PDT), Raja Sekhar <rajasn@...>
(Continue reading)

Raja Sekhar | 2 Aug 2007 16:24
Picon
Favicon

Re: batchfile as service

yes but i am adding the batchfile for apache as service using instsrv.exe and it   runs fine.
the ping one was just for testing , actually i have eventlog.exe -b -rt 120 -f serverx.txt and i want this to be
run as service than running it manually.
when i use the same syntax n batchfile and its runs with out problem.But as a service it doesnot run and that is
why i used start /min option as the eventlog.exe runs in forground and a cmd prompt is open

Raja Sekhar

  ----- Original Message ----- 
  From:   foxidrive 
  To: batchworld@... 
  Sent: Thursday, August 02, 2007 6:18   PM
  Subject: Re: [BATCH WORLD] batchfile as   service

As I see it that batch file adds apache as a service itself. It   doesn't
need instsrv.exe to do it.

What are you trying to achieve?   Your example bat file redirected the ping
output to a temp bat file and   then launched the batch file. What did you
expect that to   do?

>>>  <at> echo off 
>>> echo ping localhost -t >   work.bat 
>>> start /min work.bat

On Thu, 2 Aug 2007   04:51:52 -0700 (PDT), Raja Sekhar <rajasn@...>
wrote:

>If   we add the below mentioned batfile it is running fine.We can install this bat   file as service and then
start the service , no error
(Continue reading)

Brian Lasch | 3 Aug 2007 10:52
Picon
Favicon

Re: Help with xcopy on XP

tested

xcopy /c /s /r /d /i /y "C:\Backup\*.*" "\\XP1\C\Backup\." >
C:\AaaaA\Backup.log

by placing the . in the path the command assumes a directory

--- In batchworld@..., "Cifuno" <cifuno <at> ...> wrote:
>
> Hi
> 
>  
> 
> Using XP Home on 2 machines. Both fully updated and identical.
> 
>  
> 
> Using Xcopy to copy Directories from XP machine to XP1 machine.
> 
>  
> 
> It stops and asks if it is a file name or directory name on the target 
> 
>  
> 
> Can I somehow tell it that it is always a Folder?
> 
>  
> 
> This Batch File
(Continue reading)

Raja Sekhar | 3 Aug 2007 18:51
Picon
Favicon

Add extra \ in between

Hi,
  when i do echo %WINDIR% i get c:\windows
is there any way to make it c:\\windows ( add extra \ )

Thanks,
Raja Sekhar

       
---------------------------------
Luggage? GPS? Comic books? 
Check out fitting  gifts for grads at Yahoo! Search.

[Non-text portions of this message have been removed]

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@... 
Parag P. Doke | 3 Aug 2007 20:30
Picon

Re: Add extra \ in between

How about this ?
set abc=%windir:\=\\%
echo %abc%
C:\\WINNT

On 8/3/07, Raja Sekhar <rajasn@...> wrote:
>
>   Hi,
> when i do echo %WINDIR% i get c:\windows
> is there any way to make it c:\\windows ( add extra \ )
>
> Thanks,
> Raja Sekhar
>
> ---------------------------------
> Luggage? GPS? Comic books?
> Check out fitting gifts for grads at Yahoo! Search.
>
> [Non-text portions of this message have been removed]
>
>  
>

--

-- 
Parag P. Doke
http://paragpdoke.blogspot.com

[Non-text portions of this message have been removed]

To Post a message, send it to:   batchworld@...
(Continue reading)

aristos_vasiliou | 13 Aug 2007 10:35
Favicon

Barch file does not install the .exe files.


Hello,

I have a slight problem with a batch file. I am using the following
batch file on my unattended Windows XP CD to edit the
"RunOnceEx" registry key.

 <at> echo off

FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST
%%i:\Readme.txt SET CDROM=%%i:

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%\001 /VE /D "Critical MS Windows XP Hotfixes" /f
REG ADD %KEY%\001 /V 1 /D "%CDROM%\Software\Updates\Windows\Updates.cmd"
/f

So that after the first restart, Windows XP will run the
"Updates.cmd" batch file. The contents of "Updates.cmd"
is the following:

for /f "delims=" %%a IN ('dir *.exe /b') do "%%a" /q /n /z

"%CDROM%\Software\Updates\Windows\Switches\KB873374.exe"
"%CDROM%\Software\Updates\Windows\Switches\KB890830.exe" /q

COPY /Y
(Continue reading)

foxidrive | 13 Aug 2007 12:14

Re: Barch file does not install the .exe files.

On Mon, 13 Aug 2007 08:35:52 -0000, "aristos_vasiliou"
<aristos@...> wrote:

>I have a slight problem with a batch file. I am using the following
>batch file on my unattended Windows XP CD to edit the
>"RunOnceEx" registry key.
>
> <at> echo off
>
>FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST
>%%i:\Readme.txt SET CDROM=%%i:
>
>SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
>
>REG ADD %KEY% /V TITLE /D "Installing Applications" /f
>
>REG ADD %KEY%\001 /VE /D "Critical MS Windows XP Hotfixes" /f
>REG ADD %KEY%\001 /V 1 /D "%CDROM%\Software\Updates\Windows\Updates.cmd"
>/f

>The problem is that "Updates.cmd" never runs. Or maybe it runs,
>but the .exe files in the "Updates" folder are never executed.

I would firstly define which part of the problem needs attention.

Create a batch file with a pause command

 <at> echo off
pause

(Continue reading)


Gmane