Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using RUN/! on NT Server in version 6
Message
De
06/11/1998 15:15:08
 
 
À
06/11/1998 15:03:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00154956
Message ID:
00155347
Vues:
19
>Okay, not to be stupid or anything, but then what is the application name to call a DOS program?

You'd use an API call rather than the RUN command - if you look at the entry in the FAQ on launching an application and waiting on it's completion in the FAQ under Win32API, you'll see an example of using CreateProcess() to launch an application and wait for its return.

>
>Also - my boss suggested creating a batch file and running that instead - works, but now the batch DOS window stays open. Any ideas?

Again, the CreateProcess() or ShellExecute() API calls allow you to control the window used to run the application - it can be hidden or minimized with either call. You can cause the DOS window to close by adding an EXIT statement to the batch file, which will shut down the DOS session. And if you do a temporary change to a local hard drive, you can get rid of the problem caused by SET DEFAULT TO a UNC; your code might look something like:
LOCAL cSaveMyPath
cSaveMyPath = FULLPATH(CURDIR())
SET DEFAULT TO C:\  &&  It's always there, so why not?
mCommand = "WHOIS.EXE DRAGONMYR.COM > C:\TEMP\TEMP.TXT"
Run /N &mCommand\
If you use my LaunchAppAndWait() function from the API example, you'd simply say:

=LaunchAppAndWait("WHOIS.EXE DRAGONMYR.COM >C:\TEMP\TEMP.TXT", "C:\", "MIN")



>
>-Tina Robichaux
>Interland, Inc.
>
>
>>>I am experiencing problems with a one line of code after upgrading from 3.0 to 6.0, and I think I know why, but can't solve it.
>>>
>>>The line is:
>>>
>>>mCommand = "WHOIS.EXE DRAGONMYR.COM > C:\TEMP\TEMP.TXT"
>>>Run /N &mCommand
>>>
>>>This works fine when I change the default directory to a drive letter that the network drive is mapped to; it does not work if I change the default directory to a network path.
>>>
>>>ie. works with
>>>Set default to D:\
>>>but not with
>>>Set default to "\\SERVER1\CUSTOMER MANAGER"
>>>
>>>What it does wrong is, it tries to execute the > C:\temp\temp.txt as more command parameters, rather than a DOS pipe.
>>>
>>>So, as the DOS window whips past, I see it execute
>>>
>>>WHOIS DRAGONMYR.COM
>>>
>>>which works fine, but then it tries
>>>
>>>WHOIS >
>>>
>>>which yields an error, then
>>>
>>>WHOIS C:\TEMP\TEMP.TXT
>>>
>>>The really odd thing is, if I enter this line into the "RUN" box from the "Start" menu button in Win98, I get the same behavior!
>>>
>>>Any Windows gurus out there have a clue?
>>
>>You might want to look at using the CreateProcess() API call to launch the application for you; first, it allows you to set the starting directory independently of how VFP has it's current SET DEFAULT, and second, the STARTUPINFO structure can contain a handle that can be used to redirect output directed to StdOutput to a file (essentially, you open a file with FOPEN() or FCREATE() and pass the handle returned in the hStdOutput member of the STARTUPINFO structure. You can also embed pipes in the command line passed as the second parameter (lpszCmdLine) to CreateProcess().
>>
>>>
>>>Tina Robichaux
>>>Interland, Inc.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform