Configure the run command - rust

I begin to use geany to play with rust under Windows 10.
I would like to configure the "run command" to read stdin from a file (e.g. my_program < in.txt)
I am only interest with "run command". I tried to write "< in.txt", "<" "in.txt" in the first or in the second box of the line "run", nothing works.
Have you a solution ?
Thank you for any tips.

I found the solution : I wrote cmd /K "%e < in.txt" in the first box of the "Run" line.

Related

Close cmd window with vba excel

I have a SQL request in my vba code
Set WSJ = VBA.CreateObject(“WScript.Shell)
WSJ.run “cmd.exe /C chcp 0000 & cd C:\oracle... “ & myPath & “.sql && exit”, 1,1
it worked perfect but recently stopped closing cmd window and not continue the process (it doesn't happen all the time, 1 or 2 times for day). There is no error, the last line is «disconnected from the server», but the window does not close and the code does not continue to work.
is it possible to write in the code a check for closing cmd window after a minute or something like that? or configure sql to reach this line and close
Thanks
please try with below code
Sub closwWindow()
Call Shell("cmd.exe /S /c" & "cd /d C:\UTAS-SA && del /f/s/q BJSFM > nul", vbNormalFocus)
End Sub
As the return value of WScript.Shell.Run is not very useful, I've tried to do it in another way, but I only found a way to get this done from command prompt itself:
Using Start, I can start a command prompt with the title I'm giving it, like:
start "this is an interesting window" cmd.exe
As a result, a command prompt is started, having "this is an interesting window" as the title. You can then use Tasklist in order to find this, something like:
tasklist /V | findstr "this_is_an_interesting_window"
cmd.exe 8240 Console 6 3 636 K Running DESKTOP-D0GIHSU\plop 0:00:00 this_is_an_interesting_window
From there you can retrieve the process ID (8240) in this case, and you can use TaskKill in order to kill it:
taskkill /FI "PID eq 8240"
SUCCESS: Sent termination signal to the process with PID 8240.
Good luck

How do you run a standalone ijs j file on Linux?

I have been using j for a few weeks now and loving it. However, all of my work has been in the ijconsole. Does j provide a way to run .ijs files without using load? Similar to how you can simply run $python my_file.py?
I know for windows there exists jconsole.exe, but for Linux and OSx there doesn't seem to be the same option?
You should be able to run bin/jconsole with the .ijs file as the first command line argument.
Here's an example session, copied out of my terminal:
~/j64-807$ cat ex.ijs
d =: 1+1
~/j64-807$ ./bin/jconsole ex.ijs
d
2
I figured out how to get my desired behavior from
https://www.jsoftware.com/help/user/hashbang.htm
The basic idea is to create a "unix script" that points to jconsole by using
#!/home/fred/j64-807/bin/jconsole
at the top of the .ijs file.
Then, you can echo any output you wish or use ARGV to read input.
Finally, call chmod +x your_script.ijs and run using ./your_script.ijs
You can copy the j interpreter files to new projects on servers etc and call them using bash.
So, a final example would be
#!/home/fred/j64-807/bin/jconsole
echo +/*:0".>,.2}.ARGV
exit''
Which computes the sum of squares of digits from command line arguments

Sending Ctrl-L via dbus to terminal emulator

One can send text via dbus to the terminal emulator konsole as followed:
qdbus org.kde.konsole /Sessions/1 sendText "hello"
However I want to remotely clear the screen of the specified terminal window.
So I tried:
qdbus org.kde.konsole /Sessions/1 runCommand "clear"
Does partly what I want. Only problem: The screen doesn't get cleared when there is a process running.
In the terminal emulator, in this case the key combination "Ctrl + L" would do the job.
So I'm trying to send a string with escape characters for this shortcut.
Is this going to work? This, however doesn't do;
qdbus org.kde.konsole /Sessions/1 sendText "\033[2J"
(runCommand neither)
This is working for me:
qdbus org.kde.konsole /Sessions/1 sendText $'\014'
First, to produce a character from its octal code, the syntax "\033" would work in C but not in Bash.
Second, while "ESC [ 2 J" is a VT100 code to Erase Screen, it work for me only if I echo $'\033[2J', and that will not work if a command is running.
Third, Ctrl-L will work if a program is expecting input from a terminal (like irb or python do), but it will not work for a while sleep 1; do echo Still running; done loop.

What does this statement do on Linux?

I am trying to complete a lab report and I have just started using linux. I am really new to this ecosystem and I don't know how most of it works. I'm slowly learning from the labscript how to compile and execute C programs. However, after executing this statement
execute the output binary file using: $ ./myapp I am a student taking CMP 310
I lost the "$" sign and whenever I pressed enter this ">" would be printed before any statement and I couldn't execute or exit. If any of you could kindly explain what I did I would really appreciate it. Thank you.
You may have pasted an unmatched quote symbol, ' or " or a backtick ` and your terminal allows you to enter multiline statement and waits until you close the quote or backtick to evaluate it. To exit the multiline mode, either enter the closing character, or hit Ctrl-C, which in this case interrupts the input.
You have to paste only this part:
./myapp I am a student taking CMP 310
It tries to execute myapp executable file in your working directory (which ./ stands for), passing to it arguments I am a student taking CMP 310.
Me reproducing your problem:
16:45 $ "I have no idea what I am doing
> wut
>
>
> hello?
>
Most probably Ctrl+C will help you.
If you are working in GUI mode (not terminal) you can just close the window and open new shell session in new window.

nsis execwait returning 7

Following line in my nsis script is returning 7 :
ExecWait '"$mysqlfolder\bin\mysqldump" --user=$MySQLUser --password=$MysqlPassword --execute="tcm > D:\db_test.sql"' $2
I would like to know whats wrong with it.
Are you sure the exit code is not from mysqldump? You could verify this by running Process Monitor.
In this case the problem could be the stdout redirection (>), this type of redirection is implemented in cmd.exe so unless --execute calls cmd.exe it is not going to work.
If you want to capture the output (of the "root" child process) you have two options:
Prefix your command line with cmd.exe /C (Use ReadEnvStr "COMSPEC" if you need to support Win9x)
Use one of the exec plugins that will capture the output.

Resources