Jump to content

Recommended Posts

Posted

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

  • Developers
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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
  • Developers
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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...