Jump to content

_RunDos and Dos Box


Recommended Posts

I've been trying to get a dos subst command running.

I have discovered that it hangs if there is a dos box {"Command Prompt" already open [as I had, to un-subst it during the test phase].In fact, it hung to the extent that closing the program from the tray menu failed, and I had to 3-finger salute and stop the autoit3 wrapper process!

Is this a known problem? Is it confined to certain commands?

As this will be running off a CD on someone else's PC I need to check if there's a dos box open and kill it if so - or is there a way round this other than writing a batch file, running it, and then deleting it?

My code is

#include <Process.au3>

 $sSubst = "subst "& "B:" & " D:\cd_temp"  ;" c:\NHS_CFH_DICOM_Images\encryption")
 ;MsgBox (0, "$sSubst", $sSubst)

 $rc= _RunDOS ($sSubst)
 Exit

William

[edit] The B: will be a variable, in the full version

Edited by saywell
Link to comment
Share on other sites

I've been trying to get a dos subst command running.

I have discovered that it hangs if there is a dos box {"Command Prompt" already open [as I had, to un-subst it during the test phase].In fact, it hung to the extent that closing the program from the tray menu failed, and I had to 3-finger salute and stop the autoit3 wrapper process!

Is this a known problem? Is it confined to certain commands?

As this will be running off a CD on someone else's PC I need to check if there's a dos box open and kill it if so - or is there a way round this other than writing a batch file, running it, and then deleting it?

William

There is a way round it BUT I just ran your code with 3 x Dos prompts open and have no problems.

Try this and see if it show any problem:

#include <Process.au3>
$Drive = "B:"
$sSubst = "subst " & $Drive & " D:\cd_temp" ;" c:\NHS_CFH_DICOM_Images\encryption")
;MsgBox (0, "$sSubst", $sSubst)
;$rc= _RunDOS ($sSubst)
$Result = RunWait(@ComSpec & " /k " & $sSubst, "", @SW_SHOW)
;DriveGetDrive
Link to comment
Share on other sites

Thanks.

I think RunWait is indeed the solution - thinking back, I may have had a messagebox making a delay when it ran successfully, which coincided with having the dos box open [to do the /d to undo the substitution].

William

Link to comment
Share on other sites

Also to put some emphasis on one of your statements

As this will be running off a CD on someone else's PC I need to check if there's a dos box open and kill it if so - or is there a way round this other than writing a batch file, running it, and then deleting it?

ProcessClose() or ProcessWaitClose() could be what you are looking for. The process will be "cmd.exe". The other way is rather nasty and involves putting focus on the Cmd window and using Send("exit") but that is only for dire emergencies and may even require an extra Send() before that to break out of whatever it's doing at the time.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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

  • Recently Browsing   0 members

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