Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop Security Warning dialog

Status
Not open for further replies.

agharib

MIS
May 16, 2004
5
US
We are using

oWsh = CREATEOBJECT("wscript.shell")
oWsh.Run("BatchFile.Bat", 3, .T.)

to run a batch file from a .PRG. Works fine on 32 bit OS. On 64 bit, we get the Open File - Security Warning; with Run and Cancel buttons.
This process runs with a timer periodically; unattended. How can we disable this Security Warning screen from showing up.

Note:
We were using ShellExecute API, yet VFP does not wait until the batch run finishes; hence resorted to wscript.shell.

Adel
 
Adel,

I suggest you try running the file interactively, rather than through the scripting host. If the same security message appears, you can eliminate your call to oWsh.Run as the source of your problem (in which case the page referenced by Olaf will tell you how to deal with it).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 

Thanks Mike and Olaf for your responses.
I should add that the batch file we're trying to run gets created on the fly by forming its content as a string, then do a

STRTOFILE(mCommandString, "\\somefolder\BatchFile.BAT")

The solutions at the URL Olaf mentioned is for Windows 7. We are runninig Windows Server 2008 R2 - on the Security Warning dialog
, there is no "Always ask before opening this file" check box! For Windows Server 2008 R2, we tried gpedit.msc, then Select
User Configuration | Administrative Templates | Windows Components | Attachment Manager, and added *.bat to the Inclusion
list for moderate risk file types setting. Did not work either.

Mike - Batch fie works fine without the security message showing up.


Adel
 
the batch file we're trying to run gets created on the fly by forming its content as a string

BUT once you have created the BAT file, have you suspended your application with a SET STEP ON?

Code:
STRTOFILE(mCommandString, "\\somefolder\BatchFile.BAT")
SET STEP ON

And then executed the BAT file manually from your Windows CMD window?

As Olaf & Mike have suggested, if you were to do so you could test the validity of the BAT execution without involving VFP or Windows Scripting.

Then, if the warning message were still being generated, it would be coming from somewhere else.

Good Luck,
JRB-Bldr

 

JRB-Bldr
And then executed the BAT file manually from your Windows CMD window?


In the last line of my previous post I've indicated that the Batch file works fine without the security message showing up; when triggered from CMD window.


Adel
 
Instead of executing the bat file directly, have you tried using "RUNAS" to execute the command with elevated privileges?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top