473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Batch file wont start service after DELTREE call

384 256MB
I have a batch file and all it does is stop a service call the deltree file to empty a directory and the start the service but its wont start the service back up.

The first two lines run a fine, service stops, specified directory is emptied out and it ends with no errors and the service hasn't been started.

Any ideas/help much appreciated.

Expand|Select|Wrap|Line Numbers
  1. NET STOP "service_name"
  2. DELTREE "C:\temp\"
  3. NET START "service_name"
Deltree.bat
Expand|Select|Wrap|Line Numbers
  1. @echo off
  2. if {%1}=={} @echo Syntax: DelTree Folder&goto :EOF
  3. if not exist %1 @echo Syntax: DelTree Folder - Folder %1 does not exist.&goto :EOF
  4. pushd %1
  5. if %ERRORLEVEL% NEQ 0 @echo Syntax: DelTree Folder - Folder %1 does not exist.&goto :EOF
  6. del /q /f "*.*"
  7. for /f "Tokens=*" %%i in ('dir %1 /B /A /AD') do rd /s /q "%%i"
  8. popd
Jul 6 '10 #1
1 2549
Maybe calling NET START while the service is stopping. Try adding a 5 second delay before calling NET START.
Jul 26 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bill | last post by:
I need help closing a CMD window when it is executed from Access. 1) The batch file is called from Access. 2) Access closes, 3) the batch runs a copy of the access database (creating a backup)...
1
by: code_wrong | last post by:
Hi, I'm reading this: http://www.catch22.net/tuts/selfdel.asp (Self Deleting Executables) and playing around with the batch file method .. trouble is I always get a command box at the end with...
1
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
3
by: JoelBrimm | last post by:
I have a batch file that executes a command line utility to do a secure file copy from our server to a 3rd party server. The batch file works fine, but when I call it from the web service the log...
13
by: MLH | last post by:
I have a batch file named GetConf.bat. It contains a line like this: ipconfig /all >c:\MyAppDir\IPdata.txt I believe I could run the line with something like ShellWait by Terry Kreft. Any...
26
by: mvdkwong | last post by:
What's the trick to running a batch file from VBA? I'm trying to call it using the Shell function but it's not working for me. If I double-click the batch file or run it from the command line it...
1
by: Military Smurf | last post by:
I have a batch file that outputs to a basic text file, but when I try to launch it using System.Diagnostics.Process.Start, it doesn't seem to work. System.Diagnostics.Process.Start seems to work...
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
1
by: cryptotech2000 | last post by:
I am trying to write a batch file to do this basically and i know i dont have it right so if anyone could help me i would appreciate it.. Basically the reason i need to do this is we have an...
0
by: gabrielk43 | last post by:
Hi to all, I have made a web service which creates a batch file in a folder in web server and tries to execute it (in a Windows Server 2003 web server). So far I have managed to create the batch...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.