Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win2k DOS file error

Status
Not open for further replies.

penahill

Programmer
Nov 5, 2001
9
0
0
US
I have a 16 bit program that I need to execute a .bat file on Windows 2000. The script is being executed within VB6. When I execute the .bat file I receive an error stating the script can not be read. If I manually open the program that the script is meant for it runs fine. I change the .bat to a .pif and I receive a 16 bit MS-DOS subsystem error stating that this is an invalid program file name. I am executing the .bat & .pif command with a Shell function within VB6. I am stuck with the 16 bit program and would apreciate any help possible.

Thanks
penahill
 
Can you let us see the code involved? both the VB code and the DOS batch file would help all round with a solution.

Menthos
 
The DOS code in the bat file is the following:

C:\HQ\Scriptor.PIF C:\HQ\Batch\printscript.scp /R

I have tried running the convertscript.bat as a .pif file. The .pif file I get the 16 Bit MS-DOS error. The .bat file returns the error message that it can not read the .scp file contained within the .bat file.

The VB code is the following:

Shell "c:\HQ\Batch\convertscript.bat /s", vbHide

The .bat file is created within VB. The .bat is created with the following code:

Set notes = CreateObject("scripting.filesystemobject")

Set script = notes.CreateTextFile("c:\HQ\Batch\convertscript.bat", True)

SetDefaultPrinter ("Generic PostScript Printer")

pc_Script_Text = "C:\HQ\SCRIPTOR.PIF C:\HQ\Batch\printscript.scp /R"

script.WriteLine (pc_Script_Text)
script.Close


The program that the .bat file is for is an old 16 bit program. It runs on Windows 2000 but not very well. It is faily stable on Windows 98 but of course my company has moved to Windows 2000.

Any help would be appreciated.

Thanks
penahill
 
Don't know if this will help you but I always use cmd /c when calling dos batch files from VB shell. So your VB code will look like:-

Shell "cmd /c c:\HQ\Batch\convertscript.bat /s", vbHide

Hope this works for you.

Cheers
 
The /c switch closes the Shell once execution has finished.

Penahill - you say that you can run convertscript.bat manually from a DOS prompt? and that works? If so there shouldn't be any difference running it from a VB shell command.

My gut feeling is that it could be your Scriptor.bat file where the problem lies. Is that a possibility?
 
I guess I didn't expain the problem well enough, my fault. The .bat file will not run at the DOS prompt properly on Windows 2000. The error message is that it can not read the printscript.scp. The printscript.scp is a text file with a list of print commands that will print a plan-o-gram through a space management program. If I open the space management program and run the printscript.scp the script work fine on Windows 2000. The most frustrating thing is the VB program works fine on Windows 98 but when ran on Windows 2000 I get the above mentioned errors.
 
Aha :)

I guess we're moving OT for this particular forum, but are you able to let us have a look at the Scriptor.bat file in detail??

Not sure if the forum admins will want to move this thread to a more appropriate place.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top