-2

I need to run this old telnet scripting client silently in the background. You run it from cmd providing arguments for:

1- a file containing the commands to send

2- a file where to print any output

3- whether to run it minimized to taskbar or not

(note: if it is run without arguments, it displays a help window)

So this is what I type in cmd, and it works like a charm:

TST10.exe /r:mycommands.txt /o:myoutputfile.txt /m

What I can't achieve however, is running it completely hidden in the background. Now, since this program requires arguments, I tried to first achieve this only on the help window that gets spawned (ie: running it without arguments).

I tried with VBScripts using carefully all the answers here. It always starts normally (not hidden). These VBScripts all succeed to hide other programs though.

I also tried with this program that starts processes hidden, oddly enough it only succeeds in hiding the the telnet client from the taskbar. Also, even if it would completely hide it, I still have no idea on how to pass the mentioned arguments.


edit: How is this even CLOSE to "Prevent VBscript app from showing Console Window" or "How can I run a command silently in VBScript?"? This question VERY clearly asks how to run a normal .exe program in a hidden manner which is not even slightly related to running a VBscript without showing the console or running a command silently in VBScript. + I even stated that the only way to achieve this USING VBScipt (not hiding a VBScript itself) doesn't work. Are the accounts marking this as duplicate bots that simply detect "VBScript" and "hide program" and assume that I want to hide an executing VBScript? Or can they simply not understand English?

cablewelo2ma
  • 139
  • 2
  • 7
  • I'm lost as to what it is your asking. You say you've tried VBScript and it doesn't work, so are you looking for a solution that doesn't involve VBScript? – user692942 Jul 29 '19 at 15:54
  • I am trying to run this program in background in any way possible. I tried with VBScript, and I tried with this other program mentioned. They both fail in the same way: they hide the little thingy that appears on the taskbar for any window, but can't hide the gui window of the program. Please help me edit the question if it's so unclear. – cablewelo2ma Jul 29 '19 at 16:13
  • Any real reason to stick to this legacy app? There are plenty of tools available to script a telnet connection. – Boris Lipschitz Jul 29 '19 at 16:19

1 Answers1

-1

Try this... create a run.js or something (make sure you give it a .js extension). Place this line inside the .js:

WScript.CreateObject("WScript.Shell").Run("notepad.exe", 0);

Run it. You should see notepad.exe running in your task manager, but it's window should be hidden. Now try the same with your app instead.

Boris Lipschitz
  • 1,514
  • 8
  • 12
  • Already [answered here](https://stackoverflow.com/a/13142667/692942) in the language the OP specified. – user692942 Jul 29 '19 at 07:38
  • @cablewelo2ma My point was the answerer is just regurgitating an existing answer from the question linked. Whether that is your issue or not is not my concern. – user692942 Jul 29 '19 at 15:41
  • @Boris Lipschitz I already mentioned in my question that I tried all the methods here:https://stackoverflow.com/questions/22698508/vbs-visual-basic-script-run-program-hidden-invisible (including this one). I still tried naming it with a .js which led to the same result (it only hid the program from the taskbar (which is also stated in my original question)) – cablewelo2ma Jul 29 '19 at 15:46
  • @Lankymart I am, however, discussing your mark of duplicate on my question – cablewelo2ma Jul 29 '19 at 15:48
  • @Lankymart I added an edit to the question regarding the duplicate mark – cablewelo2ma Jul 29 '19 at 15:49
  • 1
    TBH, not looking at the linked post is my fault indeed (the "ideExecuteServerVBS.vbs" there is exactly my answer). Sorry about that. And anyway, looking at what this legacy app really does, which seems to be just establish telnet connection, supporting sending text and waiting for specific text, only (am i wrong?)... i'd consider switching to something else. For example, this (https://docs.python.org/2/library/telnetlib.html) seem to do the same thing without using legacy tools, and you are very unlikely to encounter any issues running a python instance without any windows. – Boris Lipschitz Jul 29 '19 at 16:11
  • @BorisLipschitz Thank you very much I looked around and managed to find an alternative. Regarding this legacy app however, I still would like to understand if there is any way to hide the window, or understand what makes it like this, just in case I encounter something like this. Any ideas? – cablewelo2ma Jul 31 '19 at 21:15
  • Think what happens down the call stack from that Run command (and all the similar "hiding" methods). The second argument eventually being passed as nShowCmd to ShellExecute, and finally to the executed app WinMain, which is a Windows app entry point. At the time an app creates it's main window, its up to the app to actually pass this nShowCmd down to ShowWindow. Nobody forces it to do so, it's free to ignore this value. You aren't really hiding the app here, but merely tell it "stay hidden", while most apps comply. This one doesn't. – Boris Lipschitz Jul 31 '19 at 21:46