473,569 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Hid e, 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 6268
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.Hid e, 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.Hid e, 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.co m" (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
8071
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 myProcess as New Process 2 myProcess.EnableRaiseEvents = True 3 myProcess.StartInfo.Filename = myQ.Dequeue ' The string value in this instance...
6
1478
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 whatever. Anny ideas? Is this at all possible? If not, i think i should really quit VB :( This is like the 20th thing i wanna be able to do but...
2
4063
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) where strApp is the the command line text. However this method starts a new process and therefore my application continues without waiting.
1
2443
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 ways to the end user. This works fine. My challenge lies in the fact that these XML files are generated by various (third party) applications. Which...
6
2626
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 Process.Start() method. but < is not recongnise a parameter . how can i do?
0
945
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? Thanks. Greg
4
4405
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 pictures in it. the script looks in the specified dir, and creates thumbnails if they are not present. So, displaying a particular album often takes...
5
5845
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 windows application it does not work. I am confused here, it copies files in a console application, but not windows app ProcessStartInfo info =...
4
5945
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 System.Diagnostics.Process(); procPath = @"c:\ae.bat";
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6286
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.