473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

How do I shell the following command line or process.start it (very different command!)

G'Day all,
I cant for the God in me work out how to execute the following command
line in vb.net: (watch for the word wrapping also)

Sub(ByVal username As String)

Shell("ECHO Y| cacls h:\finance\" & username & "\" & "+Common /G " &
username & ":R", AppWinStyle.Hide, True)

End Sub

Now if I was to paste that snippet into a cmd prompt and run it it
will work no worries as it does also from a .bat file.

The ECHO Y| is there because if you execute the command without it it
will ask for a <y/N> to confirm, obviously stalling the process and
not completing it.

So what are some alternatives or what am I doing wrong?

Cheers

Dave. :-)
Nov 21 '05 #1
3 6254
David Eadie wrote:
G'Day all,
I cant for the God in me work out how to execute the following command
line in vb.net: (watch for the word wrapping also)

Sub(ByVal username As String)

Shell("ECHO Y| cacls h:\finance\" & username & "\" & "+Common /G " &
username & ":R", AppWinStyle.Hide, True)

End Sub


I think the problem you're having is that ECHO is not an executable program,
but rather is a function provided by the command prompt itself. This means
you can't directly Shell it as the system doesn't know what it is.

What you can do however is shell the command prompt itself and get it to
execute the ECHO automatically. Try this:

Shell("cmd.exe /C ECHO Y| cacls h:\finance\" & username & "\" & "+Common /G
" & username & ":R", AppWinStyle.Hide, True)

(Again, watch for the wrapping).

The /C switch for the cmd.exe application tells it to execute the statement
provided and then immediately close (for more information, launch a command
prompt and then type "cmd /?" into it).

Hopefully this will do what you want -- but be aware that on Win95/98/Me,
the command processer is actually "command.com" (I think), rather than
"cmd.exe". I don't have access to a Win9x machine at the moment so I don't
know if it supports the same command switch, you'll need to investigate if
it's relevant to what you're doing.

Hope that helps,

--

(O)enone

Nov 21 '05 #2
Ahh great help! Yeah its only for server 2003, nothing else.
Ill give it a go later on when im back at the Dev machine and see how I
go.
Cheers mate

David

Nov 21 '05 #3
Great works a charm!!
Thanks mate!!!

Dave.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ty Moffett | last post by:
I'm using a queue to hold a series of strings that are complete command line arguments to start the silent/unattended installation of various pieces of software. Here is some sample code. 1 Dim...
6
by: CMG | last post by:
Hi, I have been looking for this quite some time now. I want to be able to pass along a string of data into my compiled programs, like prog.exe "myvar1" "myvar2" etc. or prog.exe /f whatever /g...
2
by: hplloyd | last post by:
Hi I want my VB.NET application to run a command from the command line and then wait for the command to finish before continuing. I am currently using System.Diagnostics.Process.Start(strApp) ...
1
by: Rune Jacobsen | last post by:
Hi, I've been trying to figure this one out, but my experience just doesn't have what it takes... :| I am writing an application that reads an XML file and displays the contents in various...
6
by: somequestion | last post by:
there are some dos command < or > it can use like this if there is a batch file as sample.bat sample.bat < parameter sample.bat parameter result . i just wanna use this when i use...
0
by: greg chu | last post by:
Hi, I wrote a service program and after msi is installed it does not automatically start the service. Do I have a way to add a custom action to start the service after msi is installed? ...
4
by: J. Frank Parnell | last post by:
Hi there, I have a list of links which point to e.g. thescript.php?album=somePictures1 thescript.php?album=somePictures2 This list is about 3000 links. Each album may have 500 or more...
5
by: =?Utf-8?B?Sm9iIExvdA==?= | last post by:
I am having issues copying files from network drive to local machine using xcopy. The following code works alright for a console application, but as soon as i call this code in Form Load event of...
4
by: garykenneally | last post by:
Hi, Im trying to run a command line application from C# but i having some strange problems with it. Heres the code im using: System.Diagnostics.Process process = new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.