ernie
New Member
Posts: 44
|
Post by ernie on Jul 1, 2022 14:35:49 GMT -5
Hello everybody--
My LB 4.51 program calls the batch file:
@echo off
cls
sfk hexdump -wide -nofile -pure columns.bmp > columns.hex
I want to dispense with the batch file and run the executable sfk.exe with these options from within LB.
I've tried this without success:
run "sfk.exe hexdump -wide -nofile -pure columns.bmp > columns.hex"
it displays the command window (unsatisfactory) for many seconds while doing the operation, but the resulting file columns.hex is never created, also unsatisfactory.
My question is, how can I run this executable with these options from within LB?
|
|
|
Post by Chris Iverson on Jul 1, 2022 16:29:01 GMT -5
You can't, because the output redirection is done by the command processor, not by the program.
If the program has an option to send output to a file, you can do that, but taking a quick look at the Swiss File Knife website, I'm not sure it does.
You can do it using the Windows API to manually run the program and then separate API calls to capture the output, but it's very complicated. Running the batch file and capturing the output afterwards would be far simpler.
If you wish, I can try to write an example of doing it the API way.
|
|
|
Post by tsh73 on Jul 1, 2022 16:42:38 GMT -5
Thank you for bringing such interesting tool
For hiding command window, there is "hide" mode be warned that "run" does not wait for operation to finish so you better check for file creation As for file got not created - well, for me I saw hexdump in that console window! So this is redirection what did not worked. I managed to n=make it run with cmd.exe /c, like this (had to put full path to sfk.exe because it is not on my PATH)
run "cmd.exe /c C:\path to sfk\sfk.exe hexdump -wide -nofile -pure columns.bmp > columns.hex" ,hide print "over"
|
|
|
Post by tsh73 on Jul 1, 2022 16:43:50 GMT -5
LOL and I just called CMD.EXE without much thinking.
|
|
ernie
New Member
Posts: 44
|
Post by ernie on Jul 1, 2022 17:25:16 GMT -5
Thanks, you guys. This was super helpful.
Ernie
|
|
|
Post by Chris Iverson on Jul 1, 2022 20:06:09 GMT -5
LOL and I just called CMD.EXE without much thinking. That's what I get for overthinking it Nice job!
|
|