Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Batch file only runs at command prompt.  Run through Explorer causes obscure error.

Posted on 2003-11-12
7
Medium Priority
?
2,075 Views
Last Modified: 2010-04-14
I haven't tried other batch files on our customers server yet, but a simple batch file that runs INSTALL.EXE (a VB app) with a few parameters, where all files are located in the same folder, causes a type of "file not found" error with the exact verbiage of :

"Cannot find the file 'C:\temp\xxxxx.bat' (or one of its components). Make sure the path and filename are correct and that all required libraries are available."  

How can it not FIND the file when I'm double-clicking on it to generate this message LOL.  The account is Administrator and the files do not have any special security on them.  If I install the program on my own workstation using various operating systems including Windows 2000 they work fine.  This is our only customer who's run into this so far.  In all my years of experience (18+) I haven't run across this before.  It seems as if there's something affecting the OS as to not let it run BAT files from within the OS.

If I shell out to a command prompt and CD to the directory to run the BAT file, it works fine.  This would normally be a perfectly fine work-around, but I feel that the root cause is affecting one of my other VB apps that also shells to DOS to run instructions.
0
Comment
Question by:z0ner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 16

Expert Comment

by:_nn_
ID: 9736348
A few things you could check :
- in My Computer / Properties / Advanced / Environment Variables : is the ComSpec one correct in the system group ?
- type 'assoc' in a cmd window, does it have '.bat=batfile' and '.cmd=cmdfile' lines ?
- does the registry look normal in HKCR\batfile\shell\open\command ?
0
 
LVL 51

Expert Comment

by:Netman66
ID: 9736349
Check the file association for the .bat extension.

To test if it is the association change the extension to .cmd and try it.

Advise.
0
 
LVL 12

Expert Comment

by:mburdick
ID: 9736483
It sounds like the "or one of its components" is the likely culprit. When you open a CMD window, you pass whole set of environment variables to all command that you run. One, some, or all of these may not be getting passed correctly to the batch script you are trying to run.

Here are a couple of things to do:

1) Make sure that everything in the script contains full paths. Don't rely on the environment variables to allow the script to find files that are on the path.

2) Expand the variables that you need in the script before executing any commands.

3) Change directories within the script to ensure that you are running the commands within the right "contexts".
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 4

Expert Comment

by:darth_wannabe
ID: 9741514
I agree with the above.....wherever you reference other files in the script, define the whole path. for instance, rather than  INSTALL.EXE have it be C:\DIRNAME\INSTALL.EXE

Also, you are double-clicking the actual file, and not a shortcut or something?
0
 

Author Comment

by:z0ner
ID: 9863283
Finally figured out what happened.  Unknown to the customer, a previous tech had renamed CMD.EXE to "DosBox.EXE".  This caused the install.bat file to choke, as well as our VB app that was hard-coded for CMD.EXE.  I guess you can't assume anything nowadays :-)
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 9887856
PAQed, with points refunded (500)

SpazMODic
EE Moderator
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Read on to get a few ideas on how to promote your next corporate event.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

670 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