Solved

Batch File Server 2008

Posted on 2010-08-26
8
884 Views
Last Modified: 2012-05-10
Hello Experts,

I have a batch file that starts up different programs with a delay in between. Some of these programs launch from C: some one them launch from UNC (\\servername\etc) the UNCs are fine but everyone of the C: I get an error that says "The current directory is invalid." I tried adding a C: at the beginning of the batch file but that didnt help. Any ideas?

By thw way this is Server 2008 Foundation I am using, this SAME batch file executes on WinXP with NO problems.
0
Comment
Question by:triphen
  • 4
  • 4
8 Comments
 
LVL 4

Expert Comment

by:zmorvik
ID: 33534593
When you execute a UNC your current directory is changing to that network location.

After each UNC call add:
c:
cd\

without seeing more of the batch file, those are my first thoughts.
0
 

Author Comment

by:triphen
ID: 33534697
The very first app to start is C:, that one already gives the error. So i dont think its that,
0
 

Author Comment

by:triphen
ID: 33534727
Here is the batch file
@echo off
ping -n 12 127.0.0.1 > NUL
start /D"C:\Program Files\SQL Anywhere 10\win32" /MIN /B db10.exe C:\SQL\SQLBASE10.db -n SQLbase -x TCPIP -ti 0 -c 128M -qp

@echo off
ping -n 8 127.0.0.1 > NUL
start /D"\\server\folder" /MIN /B Manager.exe

@echo off
ping -n 5 127.0.0.1 > NUL
start /D"\\server\folder" /MIN /B AuthManager.exe

@echo off
ping -n 5 127.0.0.1 > NUL
start /D"\\server\folder" /MIN /B Stock.exe

@echo off
ping -n 5 127.0.0.1 > NUL
start /D"C:\folder\Data\Server" /MIN /B RepSrv.exe

Open in new window

0
 
LVL 4

Expert Comment

by:zmorvik
ID: 33535040
For testing, REM the @echo off

put a PAUSE after the ping and the start line.

Something else to try, just after the @echo off, add
C:

I believe because it is starting from the network, it is essentially starting from UNC

One thing to try is on this 2008 server, change/create this registry key:
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"DisableUNCCheck"=dword:00000001
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:triphen
ID: 33535311
Same thing, I added the C: and the Reg Dword.....any other ideas?
0
 
LVL 4

Accepted Solution

by:
zmorvik earned 500 total points
ID: 33535362
what if you copy the batch file to a local folder and run it there?  Is that the entire batch file or only part of it?

I tried on a 2008 R2 machine with the batch file stored both locally and on the network and it ran with this code inside:

REM @echo off
ping -n 2 127.0.0.1 > NUL
start /D"C:\Program Files (x86)\Microsoft Office\Office12" /MIN /B WINWORD.exe

I did not try adding to a user login script to test when a user logs in, but I can.

What about the PAUSE?  Does it fail on the ping as well or only on the start?
0
 

Author Comment

by:triphen
ID: 33535396
ERRRRRRRR, I just saw the problem..

Program Files (x86) vs Program Files :)

Blonde moment.....thats why it works in XP :)
0
 
LVL 4

Expert Comment

by:zmorvik
ID: 33535421
Excellent!  So glad you noticed that.  I should have asked 32 or 64 bit as well.  Glad it's working!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now