PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → ISEC
ISEC
Débuté par Ashury, 10 sep. 2008 11:40 - 3 réponses
Posté le 10 septembre 2008 - 11:40
Hello of all,
Can I execute the following WinDev command under Windows XP:
ShellExecute("Dir", "C:\Refrence\samp.txt > C:\temp\samp_lx.txt")
Thanks,
Posté le 10 septembre 2008 - 20:55
Hello Ashury,

I don't think so, that it could work in this way. As the OS-Command Dir is part of the OS ( in fact cmd.exe ), it should work with a .cmd file ( batch file ), where you have the dir command in it and then call
ShellExecute("cmd.exe", "/C <path and filename of the batch>")

Greetings
Posté le 11 septembre 2008 - 09:39
Hi, imho ShellExecute() is used to open a program by its extension - which should correspond to to a certain piece of, uh, software on the user's computer. E.g.: ShellExecute("\Users\MyName\MyLetter.doc") will start the application which is linked to .doc files and open the referenced document. This could be Word (Microsoft Office) or Write (Open Office). Depends on your computer ..
Your misunderstanding seems to stem from the SHELL command of some other (DOS?) programming languages, which is used there to call the console (XP, Vista: cmd.exe) and automatically execute console commands.
This will not work on Vista anymore! Neither users with admin rights nor ordinary users are allowed to execute a SHELL command !
What you can safely do: Programmatically fWrite(..) a batch file (e.g. mycopy.bat) to a 'safe' directory (\Users\.. or \Benutzer in German) and after that execute this batch file by use of the ExeRun(..) command.
Please, read the Help of WinDev !
Kind regards
Guenter
Posté le 11 septembre 2008 - 15:02
Hi Günter,
Thanks,