Hi Ramani,
Thanks for your compliments
Now let's discuss this.
In my system it is in System32 directory where as WinDir is C:\Windows
But still your code will work, because the system32 directory is in OS path.
What you are looking for is cmd.exe or command.com which could work without path specified as well. But adding the path is good work and safe.
Maybe you misunderstood the real purpose of this FAQ. Or am I picked the wrong title? It took more than 3 hours for me to made it (almost 1 hour just for the title
![[blush] [blush] [blush]](/data/assets/smilies/blush.gif)
)
The real purpose is, to execute a DOS program (no windows and nowait) and continue our program while the DOS program is running in background. This is where the problems begin and DOS commander have to get involved. If we need to wait, just use "RUN DosApps.exe" will do. there is no need to call DOS commander.
Yes you are right. Call the cmd.exe or command.com will worked. But why I provided the function is to make it works for any configuration. I don't want to get risk that it doesn't work for some *weird* configuration (I believe there are not many

). So it is provided to get the proper commander for each OS.
For Win9X/ME, probably there will no problem because the system only have one commander (command.com). But for NT based, both cmd.exe (32bit) and command.com (compatibility mode, 16bit) are exists. That's why the function checked for cmd.exe first. I can't use COMSPEC, because some people (who works on NT) sometimes changed it to use command.com instead of cmd.exe (I did it to make a 16bit apps). So I have to make sure that VFP is running the 32bit version of DOS commander.
There are other reason why I used the function just to get the commander, e.g. Dual (or more) boot. Again, I don't want to risk that the function will fail, under any configuration (well, I hope).
Now for the purpose I have mentioned, I can't use "loShell.Run(lcCmd,1,.t.)". But I put it for the third example with "loShell.Run(lcCmd,0,.f.)"
Finally, Thank you for the correction. The FAQ has been updated, hope it works now (for real

).
I should have tested the function first before submitted
![[blush] [blush] [blush]](/data/assets/smilies/blush.gif)
. I didn't test the function on NT based because my 2K got infected with a worm virus since two weeks ago (grr.. too lazy to fix/reinstall it). I forgot that DOS commander for NT based is under system32 directory (not in windir, DUHH!). The function will fail to get the correct one. Now I used COMSPEC but only to get to the right path.
To Slighthaze
I just saw one of your FAQ ( faq184-4259 ). Looks like it has the same purpose with mine. I didn't mean anything to your faq. If it is the same with my faq, please accept my apology. And I will delete mine.
Thanks and best regards
-- AirCon --