Solved

Shell command in Visual Basic 2008 (Running cacls commands)

Posted on 2008-10-09
3
3,054 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now