Solved

Shell command in Visual Basic 2008 (Running cacls commands)

Posted on 2008-10-09
3
3,071 Views
Last Modified: 2012-06-22
I'm trying to use the SHELL command in Visual Basic to set folder security on a remote drive.

I'm using..
Shell("cacls ""\\ukpreflr1\preston1$\" & PNumber.Text & "\01 Quotations"" /E /P Domain\Proj-" & PNumber & ":R")
This command is repeated to set the security on another 30 folders...

This works fine, however, i am asked "are you sure" on several of the folders.. i do i pass a "Y" to the shell?  In Vbscript i could use "echo Y|cacls..." but this won't work in Visual for some reason... Anybody got any idea's?


Secondly, whilst each command is processed, the shell window sits on top of the VB Application, how can i stop this so that the status i created on the Application can be seen?
0
Comment
Question by:inbisit
  • 2
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 22685067
Hi,
You can use the Process class static methods to run the shell command and start the command window invisibly. Then you can probably use the Sendkeys function to send Y to the process.
0
 

Author Comment

by:inbisit
ID: 22685285
Hi,

I'm a novice Vb user... would you happen to have an example?

Thanks.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 22685376
Following article provides all the information you need.
http://www.thescarms.com/dotnet/Process.aspx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question