473,799 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why this code is not working???

JH
Can somebody help me here. The following code works fine till the last
statement. It changes to the directory
but fails to execute the command install.cmd. The file install.cmd is
located at the directory name.
Thanks

Dim directoryName As String

Dim WshShell
directoryName =
Path.GetDirecto ryName([Assembly].GetExecutingAs sembly().Locati on)
WshShell = CreateObject("W script.Shell")

WshShell.Run("c md /k cd " & directoryName & "\" & "Install.cm d")
Nov 20 '05 #1
5 1032
* "JH" <yh*******@yaho o.com> scripsit:
Can somebody help me here. The following code works fine till the last
statement. It changes to the directory
but fails to execute the command install.cmd. The file install.cmd is
located at the directory name.


Why not use 'System.Diagnos tics.Process.St art'?

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #2
Cor
>
Why not use 'System.Diagnos tics.Process.St art'?


Do you know who did give this method to John yesterday?

It has a style that looks to me to............. .......

\\\
Shell("C:\bla.e xe")
///

:-)

Cor
Nov 20 '05 #3
* "Cor" <no*@non.com> scripsit:

Why not use 'System.Diagnos tics.Process.St art'?


Do you know who did give this method to John yesterday?

It has a style that looks to me to............. .......

\\\
Shell("C:\bla.e xe")
///

:-)


Sorry, I don't understand.

BTW: I have adapted the code Fergus and you developed for sending mails
by opening the default mail client. I played around and I found out
that subject and message will have to be encoded too (otherwise there
may be wrong results if the message or the subject contain certain
characters like "@" and/or "&". Here's the final version:

\\\
Imports System.Diagnost ics
Imports System.Web

Public Sub StartDefaultMai l( _
ByVal [To] As String, _
Optional ByVal Subject As String = "", _
Optional ByVal Message As String = "" _
)
Try
Dim psi As New ProcessStartInf o
psi.UseShellExe cute = True
psi.FileName = _
"mailto:" & HttpUtility.Url Encode([To]) & _
"?subject=" & HttpUtility.Url Encode(Subject) & _
"&body=" & HttpUtility.Url Encode(Message)
Process.Start(p si)
Catch ex As Exception
Throw New Exception("Defa ult mail client could not be started.", ex)
End Try
End Sub
///

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #4
Cor
Hi Herfried,

Thanks, this one was more Fergus than me.

It was more that he said it could not, and I knew it could and then he made
this code.

I will investigate what you wrote but not today anymore.

That "Shell" is because yesterday someone asked what methods where there,
and I was just looking at that diagnostic procedures so I gave an answer.

And yes of course Herfried comes with an answer for the shell.

And now you ask when the shell is used.
Why not use 'System.Diagnos tics.Process.St art'?


:-))

Cor
Nov 20 '05 #5
Cor,

* "Cor" <no*@non.com> scripsit:
Thanks, this one was more Fergus than me.

It was more that he said it could not, and I knew it could and then he made
this code.

I will investigate what you wrote but not today anymore.
:-) Let me know if you find out something interesting.
That "Shell" is because yesterday someone asked what methods where there,
and I was just looking at that diagnostic procedures so I gave an answer.

And yes of course Herfried comes with an answer for the shell.

And now you ask when the shell is used.
Why not use 'System.Diagnos tics.Process.St art'?


:-))


:-))) -- Now I understand...

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #6

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

Similar topics

171
7801
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles) like it because you can split the code from the design. That is logical. But if you are the only one working on the code, it seem a little overkill. I use Dreamweaver to do my design and find it a bit of a hassle to have multiple files open...
17
2721
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but know nothing about ASP. He can build the design of the pages in HTML with tables, labels, textboxes etc. But then I would need to change them to ASP.net objects and write the code to make the page work (normally I do this as I go - can't do this...
0
1585
by: George2 | last post by:
Hello everyone, From the definition of working set, it is a subset of virtual pages resident in physical memory -- from book Windows Internals. It means working set could not be larger than virtual memory (subset relationship). But the following simple code on Windows Server 2003 proves (if you monitor virtual bytes counter and working set bytes conuter from perfmon), if we do not unmap the page map file, the working set will continue to...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10269
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
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
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.