Solved

Batch Command Substitute

Posted on 1998-06-11
30
429 Views
Last Modified: 2013-12-28

My problem is this: I want to run a dos application before the computer start.
On win95 I can put that one on autoexec.bat and everything is going to be fine.
How this can be done at WinNT? Server or Workstation?

 - The need -
 I have a monitor which need a refresh rate change through a DOS application. I do not run this program before the GUI start then I can not see what is in front of me, screen is blank, so in few words this application is needed to be run before the GUI start. Win95 let you do it throught autoexec.bat but the WinNT everything works by profiles after you login. How this can be done ???
 
0
Comment
Question by:elvaaa
  • 13
  • 5
  • 5
  • +5
30 Comments
 

Expert Comment

by:Kilgast
Comment Utility
I am very afraid that you are out of luck with this one. NT will not let such a program execute, since it is bound to access the hardware directly.

Your only chance in my best opinion is to locate an NT driver for this monitor, or a compatible one.

Kilgast
0
 
LVL 17

Expert Comment

by:mikecr
Comment Utility
I agree with Kilgast, if you do get it to run before the GUI interface your going to have problems. NT doesn't like and won't tolerate accessing hardware directly. I would suggest that either get a different monitor or find a drive like Kilgast says that will work with NT. If you don't your going to wind up getting the BSOD! "Blue screen of Death".

Thanks,
Mike
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute

Never tried this myself.
0
 

Author Comment

by:elvaaa
Comment Utility

 ahoffmann,

 How should I enter the command there? Everything in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute is in binary and hex form.

 My problem is this:
 My video card S3 Trio V64 has a dos utility I used to run on this old computer to obtain a better monitor refresh rate. The question that I should go and get a different monitor is unacceptable. The monitor has not have to do with this thing. Video card yes. Buying a video card is also unacceptable as well at the time when the video card I have works just fine. My monitor works fine in Win95 and WinNT(read note below how) at 1024x768. Although I run the s3refrsh.exe utility at autoexec.bat in Win95 after I have configured the Windows display at 1024x768 the display and everything works fine.
Even in NT I can switch at 1024x768 by putting s3refrsh.exe at startup folder(hence here that I should work blind in pressing ALT+CTRL+DEL and later figure out how many times I should press the TAB key moving between text boxes in login box and later login in NT).
Or I can do the following: I run the NT at 800x600 and later after I login I run the s3refrsh.exe and configure the NT to 1024x768 but everything should be repeated after I reboot the computer.
One suggestion is that I see that NT runs after boot the Ntdetect.com file. Where this file(from where) is called. Can somebody find that so I can put my refresh rate utility after Ntdetect.com is loaded.

0
 
LVL 5

Expert Comment

by:carmine
Comment Utility
I confused here, why can't you set the refresh rate in the screen properties dialog box?  Unlike Win95, NT allows you to set the refresh rate to any of the values supported by your video card - assuming you've loaded the correct driver.
0
 

Author Comment

by:elvaaa
Comment Utility

 carmine,

 I can set the refresh rate in the screen properties but it does NOT work unless the the dos refresh utility set the refresh rate to the video card. Once this dos utility is loaded(it is not a driver, it only just an .exe file that set the refresh rate inside the video card and manipulates the RAMDAC speed if you have the idea of that) the screen resolution does not matter. Another time I have to repeat that the monitor has nothing to do with this. This is a video card problem which has been corrected on the next version of S3 Trio V64+ and in my case the problem for resolutions above 800x600 is corrected through this .exe file which is called in autoexec.bat but I do not know how I can start this dos .exe before the GUI or simply before the login screen appears ...
 
0
 

Author Comment

by:elvaaa
Comment Utility
Adjusted points to 15
0
 

Expert Comment

by:reload
Comment Utility
have you tried to add the exe to a local login script?
                                             
                                              RELOAD
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
elvaaa, if you see binary data in that registry key, you've used regedit, use regedt32 instead ;-)
0
 

Author Comment

by:elvaaa
Comment Utility

 ahoffmann,
 I tried your suggestion using the regedt32.exe but no luck. I saw there the autochk* entry and I tried to figure out how the NTdetect.com is called from the registry.

 reload,
 Where is that login script. I have no trouble using the resolution after I login blind because of the fact that I can run this .exe through startup folder.

 ONE thing I have noticed. this exe refuses to run in window box in NT and wants to run in full screen. In win95 this exe takes the control and expand itself in full screen a thing that Nt does not allow it unless I change its settings(pif shortcut settings). In win95 everything run smooth and the .exe accomplish its task right from the entry in autoexec.bat and when the GUI comes up everything is already set up seconds ago.
Does anyone knows HOW and from WHERE this ntdetect.com(which checks the hardware) is called right after the boot... so I can put the entry of s3refrsh.exe there? Thanks...
 
0
 

Expert Comment

by:reload
Comment Utility
not sure exactly where you put it but you should be able to specify it on one of your login screens....  i just setup a batch file that executes from the server via a login script that upgrades the intranetware client for NT. runs like a champ, but the login scripts are ran from the novell server. on one of the tabs when using the intranetware client it lets you specify one or more additional login scripts to run on startup. but its been so long since i've even seen the original login screen for nt (i always install a new client) that i can't remember where you put those scripts. when all else fails though... RTI (read the  instructions). i'm sure you'll find what you need in the help files.....you know that place you don't want your friends to know you go for help. 8-)

                 RELOAD
                                         
0
 

Author Comment

by:elvaaa
Comment Utility

 reload,

 I am very sorry but you probably have missunderstood my problem if I can call it so. I can set the refresh rate after I login at any time even without a login script and by putting the command at the startup folder. I want to start this exe BEFORE the GUI start up SIMILAR you do at win 3.0/3.1/95 by placing the command(.exe entry) at autoexec.bat.

 My journey looks like this:

 Once I liked the 1024x768 at win95/linux(even linux has a utility to run that .exe just as the autoexec.bat does) but I thought I may turn to WinNT. I start my computer I see character screens in the begining and later everything disappears. But I still remeber that if I press ALT+CTRL+DEL I get the login screen appears and the password text box has the focus now. I type the password and press ENTER. Later after a few secs. the startup folder shortcuts start to execute and one of them is and the S3 refresh rate utility and right at this moment I see my desktop. Later I can log off(not turn off) and login as another one if I want but this time the s3refrsh.exe has done its work at the firt login.

 I had a look at login scripts help file.
 => logon script
Files that can be assigned to user accounts. Typically a batch file, a logon script runs automatically "every time the user logs on". It can be used to configure a user’s working environment at every logon, and it allows an administrator to affect a user’s environment without managing all aspects of it. A logon script can be assigned to one or more user accounts. See also batch file.

 =>Login script path
When a user logs on, the computer authenticating the logon locates the specified logon script (if one has been assigned to that user account) by following that computer's local logon script path (usually C:\Winnt\System32\Repl\Imports\Scripts).
See also logon script.

 ... elvaaa ...

 SIMPLY how I can manage to run an "dos" .exe file just as we used to start the win.com(win 3.1) few years ago... is that possible(I believe so -- example => ntdetect.com at boot)...
 
0
 
LVL 6

Expert Comment

by:alamo
Comment Utility
I think ahoffmann had it right.

ntldr reads the hidden file boot.ini (in the root directory) and puts up the boot menu. If you pick NT (as opposed to DOS or Win3.1 if you have multiboot set up) it starts ntdetect.com. boot.ini contains options to invoke ntdetect.com with, but doesn't say what to run, ntldr always runs ntdetect.com, it's not optional.

ntdetect is the program that puts up the "press spacebar now for last known good configuration"... it then loads and initializes the kernel and the device drivers. If you ran your program before this, the starting up of the device driver would cancel its effects anyway, I think.

One of the things the kernel does, before it starts up the whole windows interface and allows logons, is start the session manager. And one of the things the Session Manager does is check the BootExecute item in the registry that ahoffmann mentioned. This is pretty late in the boot process so it sure seems like the place for your program.
0
 
LVL 6

Expert Comment

by:alamo
Comment Utility
So, go to the key ahoffmann gave using regsvr32.
Click on the BootExecute key.
Select "Multi-String" from the Edit menu.
Add your program name on the line after the autochk line (don't put a path here)..

I can't find it documented anywhere, but I think your program needs to be in your system32 directory, and specified without a path, since I don't think the drive letters are set up yet. At least, that's the safest way to do it.

Hope this helps...
0
 

Author Comment

by:elvaaa
Comment Utility

alamo,

What the ntdetect.com or other device driver is loaded does not effect the monitor refresh rate the video card supports. I have set up already the default setting for the video card is the hardware dafault card(meaning that NT will accept every default setting offered from the card) and the s3refrsh.exe has the permission through another utility called Trio Feature Connector Utility to override the default one. This thing not only works only in dos, win 3.1 or win95 but even in linux and I am veri dissappointed that winnt does not allow me to startup this .exe as I can do in autoexec.bat. All I mean is that whatever the nt decides to do with the card is overrided through this .exe(whatever the system is) file and is working in win95 and linux just fine, while in NT I can not find the way how to run this .exe before the GUI starts.

Now can someone explain how I should use the regedt32.exe to make possible to run s3refrsh.exe after the boot because I tried once as the ahoffmann mentioned but it did not work. Probably I did not do it right.
I adjusted the points to 20(well it is just an autoexec.bat question that probably even a microsoft support will wonder how to do it)
 I simply wondering how this thing can just easily can be done(loaded .exe succesfully) from linux and it seems quite impossible at least for a beginner in NT to load .exe before GUI start ...
 
0
Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

 

Author Comment

by:elvaaa
Comment Utility

 I will try what you say alamo. The first time I did it I included the path(even the dirve letter). I will put this .exe in system32 and in c:\ directory ...

 I will comment about this about 15 minutes later ...

 
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
If you accept to login blind, there are a few other keys which can be used:

HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\load
HKCU\ ..                                                 \run


I'm not shure about the first one (HKLM), think it's for Win95.
But the last 2 one should work.

0
 

Author Comment

by:elvaaa
Comment Utility

ahoffmann,

I am login blind(remembering what comes after some keystrokes) but the reason I am asking for help is THAT I do not want to login anymore blind.

You are right they are both valid in win95 and nt but with the exception that nt loads those registry keys after you login(in my case blind) which I do not need them at all because of the fact that I already have placed a shortcut of the .exe at startup folder and is quite equivalent with those registry keys.

I think it may come something out from what you proposed in the begining, I already tried these keys at:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute

autocheck autochk *; %SystemRoot%\system32\s3refrsh.exe  1024 5
autocheck autochk *, %SystemRoot%\system32\s3refrsh.exe  1024 5

autocheck autochk *
%SystemRoot%\system32\s3refrsh.exe  1024 5

 s3refrsh.exe was residing at c:\, c:\winnt and c:\winnt\system32\

using ,; and space but without any result. If those are being executed I should have seen the login screen after the reboot.
Am I putting those entries right?
Another thought: what about if I make a batch file(text) and I put the entries:

c:\s3refrsh.exe 1024 5
c:\ntdetect.com

and rename this file ntdetect.com. Is NT going to execute properly this batch? Does this ntdetect.com is called with additional parameters which may lead to a great mess like screwing up the whole system(I tried one to boot from A drive and a DOS BOOT formated was unable to read the C:\ drive{NTFS formatted}) and I hope this is not going to happen?

 Any ideas?? everything will be appreciated ...
 
0
 

Author Comment

by:elvaaa
Comment Utility

ahoffmann,

I am login blind(remembering what comes after some keystrokes) but the reason I am asking for help is THAT I do not want to login anymore blind.

You are right they are both valid in win95 and nt but with the exception that nt loads those registry keys after you login(in my case blind) which I do not need them at all because of the fact that I already have placed a shortcut of the .exe at startup folder and is quite equivalent with those registry keys.

I think it may come something out from what you proposed in the begining, I already tried these keys at:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute

autocheck autochk *; %SystemRoot%\system32\s3refrsh.exe  1024 5
autocheck autochk *, %SystemRoot%\system32\s3refrsh.exe  1024 5

autocheck autochk *
%SystemRoot%\system32\s3refrsh.exe  1024 5

 s3refrsh.exe was residing at c:\, c:\winnt and c:\winnt\system32\

using ,; and space but without any result. If those are being executed I should have seen the login screen after the reboot.
Am I putting those entries right?
Another thought: what about if I make a batch file(text) and I put the entries:

c:\s3refrsh.exe 1024 5
c:\ntdetect.com

and rename this file ntdetect.com. Is NT going to execute properly this batch? Does this ntdetect.com is called with additional parameters which may lead to a great mess like screwing up the whole system(I tried one to boot from A drive and a DOS BOOT formated was unable to read the C:\ drive{NTFS formatted}) and I hope this is not going to happen?

 Any ideas?? everything will be appreciated ...
 
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
As I said in my first answer: I never tried this solution (sorry for answering "blind" ;-)

But if I read the syntax of the registry key, I thing that you cannot pass arguments (probably you can try to quote the program together with its args).
Try to put just
  s3refrsh.exe  1024 5
in a batch file and call this in the registry.

Renaming ntdetect.com is a nice idea. I'm not shure if M$ was so clever to restrict such tricky hacks ;-))
 
0
 
LVL 6

Expert Comment

by:alamo
Comment Utility
My explanations about ntdetect.com earlier were simply to explain how it worked. I really believe you should forget completely about ntdetect.com, not only is it dangerous I think it's a dead end.

The BootExecute syntax appears to not be documented, only by examples. Looking at the main example:

autocheck autochk *

I observe that there is no program autocheck.exe but there IS autochk.exe. Therefore I think the first parameter is a "tag" and the filename is the second paramer, followed by your arguments.

Therefore, try making the BootExecute entry:
autocheck autochk *
refresh s3refrsh 1024 5

See if that works...
0
 
LVL 3

Expert Comment

by:TSauer
Comment Utility
Take the AutoExecNT Service from the resource kit.

Here the description:

The AutoExNT service allows you to start a batch file, AUTOEXNT.BAT, at boot time without having to log onto the computer on which it will run.

AutoExNT includes an /interactive option (analogous to the /interactive option of the AT command) that allows you to see the processes started. To use AutoExNT, you must be running Windows NT 3.5 or later.
0
 

Author Comment

by:elvaaa
Comment Utility

 alamo,

 your suggestion did not work...


 TSauer,

 I still can not get it. What is this AutoExecNT Service, I never heard of this? Anyway I do not have a resource kit(CD) but you can tell me where I can find it.

 You brought me up something very unusual which is probably what I am looking for. I do not think that those crazy guys at Microsoft will build a service just for the dos .exe after the boot. While searching today I found out that autoexec.bat in c:\ dir is not the one NT uses for DOS apps but it uses a file called "autoexec.nt" which resides at c:\winnt\system32 dir but I need some help how I should jeopardize between switching the parsing of autoexec.bat with autoexec.nt.(even there is a not in autoexec.nt where says that autoexec.nt should be used for dos apps).
Things I need to configure according Microsoft Technical Service(web) is the PATH and the ENVIRONMENT(which one to parse) ... and I think this is the way I should go now after several days of login "blind" for real.
Since I do not have a resource kit CD(WINNT Workstation 4.0 and the Service Pack 3.0 for WINNT Workstation)
 ...

 When I perform a search at Microsoft AutoExecNT returns no matches!? Where can I get this service, since it seems that MS web site has no index entry for it.
 
 
0
 

Author Comment

by:elvaaa
Comment Utility

 Sorry! I do not possess the resource kit but I possess the WINNT CD and Service Pack 3.0. Miss-spelling above!!
0
 
LVL 6

Expert Comment

by:alamo
Comment Utility
AutoExNT.exe sounds like it would work, it is unfortunately a utility you must pay for (it's not downlaodable from MS). I found a link to it on a non-MS site the net but it was gone, MS must have done the same search.

The AUTOEXEC.NT batch file you mentioned isn't what you want, it runs every time you open a dos application.

I did some more checking into BootExecute and it appears that programs need to be specially written for it, you can't use just any program. So that's a dead end too.

Thinking about the real problem - that you have to login blind - I think the best "solution" until you can somehow get a copy of AutoExNT.exe to try it may be to turn on Auto-logon. This way when you boot you never see the login dialog, and therefore the refresh utility in your startup folder will run. I have had this enabled on my home machine for a long time, it's a pain to always have to log on when you are the only user.

Here's the procedure, from the NT FAQ:

Q. How do I enable AutoLogon?

A. The easiest way is to install TWEAKUI, and goto the Network Tab and just fill in the boxes. It can be done manually through the registry by following the
instructions below:

   1.Start regedit.exe (Start - Run - regedit)
   2.Open the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\Current Version\Winlogon
   3.Double click the DefaultDomainName and fill in your domain name
   4.Double click the DefaultUserName and fill in login name
   5.From Edit menu select New String Value, and enter DefaultPassword as name of value
   6.Double click the DefaultPassword and enter in the password
   7.From Edit menu select New String Value, and enter AutoAdminLogon as name of value
   8.Double click the AutoAdminLogon and set the value to the number 1
   9.Close regedit
  10.Logoff and you will be automatically logged in again

To logon as a different user you need to hold down the shift key as you logoff.

Q. How do I disable AutoLogon?

A. Again use TWEAKUI, or in REGEDIT set AutoAdminLogon to 0, and clear the DefaultPassword

0
 

Author Comment

by:elvaaa
Comment Utility

 alamo,

 You are right. Autologon entry in registry solves the problem of login "blind" but turns off the what I think the NT is created("the security I think is the only feature I see in NT comparable with other systems like Unix") and put the border with win95.
 
 I think I am going to turn back to Linux for many reasons. This computer is old and Linux requires less resources than Nt does and Linux is much pain free. The Server service I have never started and if I want to start it(hence here that I follow some of the rules) I get the NT Blue Screen of Death telling me to contact the Administrator(hence here that I am logged as Administrator) to correct the problem and give me some drivers lists for what??

 What is this AutoExNT.exe ? A service pack or an extra$ utility. Does it comes with the WinNT Resource kit(Book and CD)?

 It seems now that I have to pay for the resource kit just to fix a minor problem. Eventually this NT Performace costed me around $100(Academic Price VC++ plus NT Workstation) and will require probably around $40-50 more for the resource kit. Note here that I brought the Linux Slackware 3.4 from linuxmall.com for $5 and $5 shipping a total of $10 comming with a web server(apache), e-mail server(pop/smtp), news server, and 1 billion user licenses(unlimited). This Microsoft Stuff cost a hell! ...

 alamo thanks and post an answer to get the pionts and thank you all of you guys for the precious help you gave me ...

 elvaaa,
 
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
does it realy need so much words to get rid of M$ and used to linux?
:-))
0
 
LVL 6

Accepted Solution

by:
alamo earned 20 total points
Comment Utility
AutoExNT is the service Tsauer mentioned, from the Server resource Kit, which runs AUTOEXNT.BAT when the machine powers up without waiting for a user to logon. And geuss what, I just did another search of the net for it, and I found a site that has it posted, heheh. It's from a pre-4.0 resource kit, so MS must not have cared so much that it was posted. Look at http://www1.taunet.net.au/cdlib/NTRESKIT/ Get the files AUTOEXNT.TXT (which is the readme), AUTOEXNT.EXE, INSTEXNT.EXE, and SERVMESS.DLL.

To install, put them all in your system32 directory and type "INSTEXNT install", then set it to start up automatically using the Control Panel services app. And set up autoexnt.bat to call s3refrsh.exe.

I tested that this app works on NT workstation, and it does. So if this doesn't work for you probably nothing will.

Hope this works, good luck!
0
 
LVL 3

Expert Comment

by:TSauer
Comment Utility
The autoexnt service is the only way for you to solve yr. problem. I can´t send you the program, but i mentetion that you buy this resource kit, there is a lot of usefull stuff in it.
0
 

Author Comment

by:elvaaa
Comment Utility

 Good Work and thank you all ...
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
address book on outlook 2016 mac 7 46
Windows Backup image 3 22
Mouse freeze on PC 10 47
Printer Server  - Drivers 3 31
Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

771 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

14 Experts available now in Live!

Get 1:1 Help Now