Sign in to follow this  
Followers 0
confutatis

Can a "Run(@comspec..." window be hidden?

6 posts in this topic

Hello to all,

I'd like to be able to run "plink.exe" using the command processor. The problem I'm having is I don't want the CMD window to be visible to the user while it's running. I can't figure out how to hide the window--if it's possible at all. Here's the code:

#include <GUIConstants.au3>
#include <file.au3>
#include <string.au3>
#include <date.au3>
#include <constants.au3>
;#include <ie.au3>

Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)


$file1=FileOpen("\\evep\test$\pc_log.txt",1)
$pc_name=@ComputerName

$begin = TimerInit()
Run(@ComSpec & " /C \\evep\test$\plink.exe -load "& '"ept via internet"'&" -l "&'"xxx"'&" -pw &'"xxxxx"'&"")
sleep(15000)

$dif = TimerDiff($begin)-15000
Send("6 {ENTER}")

$rec1=$pc_name&"--->"&@TAB& $dif
FileWriteLine($file1,$rec1)
FileWriteLine($file1,"=================================================================="&@CRLF&@CRLF)
FileClose($file1)

I don't want the users to "get in the way" of the running plink command. Any ideas?

David

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Parameters

filename The name of the executable (EXE, BAT, COM, or PIF) to run.

workingdir [optional] The working directory.

flag [optional] The "show" flag of the executed program:

@SW_HIDE = Hidden window

@SW_MINIMIZE = Minimized window

@SW_MAXIMIZE = Maximized window

standard_i/o_flag [optional] Provide a meaningful handle to one or more STD I/O streams of the child process.

1 ($STDIN_CHILD) = Provide a handle to the child's STDIN stream

2 ($STDOUT_CHILD) = Provide a handle to the child's STDOUT stream

4 ($STDERR_CHILD) = Provide a handle to the child's STDERR stream

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello and thanks for the reply...

You know, I swear I tried that and it didn't work...I just tried again and now the window is hidden.

Sorry for the waste of space for a question I had already answered. ;)

David

Edited by confutatis

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hello and thanks for the reply...

I've tried adding the @SW_HIDE, but still visible.

David

Did you try to run it without @Comspec and using @SW_HIDE ? Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Did you try to run it without @Comspec and using @SW_HIDE ?

On the subject of the same script...

When I go ahead and run this script, for some reason, the "plink.exe" process doe not terminate--I can still see it in Task Manager. Any ideas why it would not end along with the script?

David

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0