Solved

Shell command in Visual Basic 2008 (Running cacls commands)

Posted on 2008-10-09
3
3,077 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

707 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