Jump to content

Problems running Command Line commands


Recommended Posts

I have problems running both Bat files and Command line instructions.

This function hopefully shows what I have tried so far

Global $fFileToCreate = "", $DOS
ScanFilm($fFileToCreate)
Func ScanFilm($fFileToCreate)
  MsgBox($MB_SYSTEMMODAL, "Scanning Status", $fFileToCreate)
;  $DOS = Run(@ComSpec & " /c " & "scan.bat" & @CRLF, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
  $DOS = Run(@ComSpec & " /k " & "ncat 192.168.1.6 80 <scant.txt >scanrep", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
;  $DOS = _RunDOS("ncat 192.168.1.6 80 <scant.txt >scanrep")
ProcessWaitClose($DOS)
$Message = StdoutRead($DOS)
MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $Message)
Endfunc

My first attempt running scan.bat reveals a bug in cmd.exe where the result of

echo !SR | ncat 192.168.1.6 80 > scanrep

is

C:\S3_GUI\ncat>scan.bat

C:\S3_GUI\ncat>echo scant.txt   | ncat 192.168.1.6 80  1>scanrep
Ncat: .

C:\S3_GUI\ncat>

note the added '1' which then throws the error, (when client is connected), "File or directory not found" so the command fails.  This has been run on four different computers running Windows 7 with same result.

Next using Run() seems to truncate the command so $DOS reads:

Std_Out_Read.jpg

Using _RunDOS() doesn't throw any error but MsgBox() is empty.

 

 

 

 

 

 

Std_Out_Read.jpg

Std_Out_Read.jpg

Edited by fopetesl
too many images again!

The most powerful number in the Universe.  Zero.

Link to comment
Share on other sites

  • Developers
5 minutes ago, fopetesl said:

My first attempt running scan.bat reveals a bug in cmd.exe where the result of

note the added '1' which then throws the error

Don't think this is a bug but merely telling you at the STDOUT (1) output goes to the file. 

7 minutes ago, fopetesl said:

Next using Run() seems to truncate the command so $DOS reads:

Which RUN command is that as the current active Run()m command pipes the STDOUT to a file it is expected that only the DOS prompt is returned?

Jos

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.
  :)

Link to comment
Share on other sites

2 minutes ago, Jos said:

Don't think this is a bug but merely telling you at the STDOUT (1) output goes to the file. 

Which RUN command is that as the current active Run()m command pipes the STDOUT to a file it is expected that only the DOS prompt is returned?

Jos

I cannot argue with your logic regarding (1) output except when 'live' it fails with the error as stated.

I clearly have misunderstood StdOutRead() then. I'll try and pay more attention to F1 :)

 

The most powerful number in the Universe.  Zero.

Link to comment
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
 Share

×
×
  • Create New...