don't run low level command (exec f)
Blitz3D Forums/Blitz3D Beginners Area/don't run low level command (exec f)
| ||
Hello, I need to run some low level command from my blitz program. I use this command (very simple....) ExecFile("copy blank\*.* . /Y") It's return 0. Why? If i use the command from cmd (prompt msdos) it works, but if i use into my program located in the same folder don't works |
| ||
'copy' is not a native command, it's an internal command inside the command prompt. There's no copy.exe to invoke, but it's a feature of cmd.exe itself. Since your program is NOT launching from within DOS, but it's a native windows program, it has no knowledge of copy. Even if you launch your program from the command prompt, it 'escapes' into windows outside of the context of the command prompt itself. You can do this instead: ExecFile("cmd.exe /c copy blank\*.* . /Y") This will call CMD.exe (the command prompt), and the /C command tells it to invoke the 'copy' command with its parameters. (Not tested, but should work) Oh, one final thought: do keep in mind that this means that you'll have an external dependency on CMD for it to work. On some corporate networks, there are network policies in place that keep people from launching the command prompt, which would also break your copy functionality. No big deal if this is a program you're writing for personal use, but if you intent to do something with this program then the proper approach is to create your own copy function without the external dependency. |
| ||
thanks for this good tricks. now all works fine. |
| ||
As Vivaigioshi, Thanks very much for this infos . |