473,785 Members | 2,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difficulty using "Shell"

I'm trying to create a folder, append text file to
another, and delete files using the "Shell" command. But
I always get the error "File Not Found".

How do I use DOS commands from Visual Basic?

My code is something like:

Dim folderPath as String
folderPath = "C:\MyFolde r"
Shell ("md " & folderPath)
Nov 20 '05 #1
9 9327
"Amjad" <am*********@ho tmail.com> schrieb
I'm trying to create a folder, append text file to
another, and delete files using the "Shell" command. But
I always get the error "File Not Found".

How do I use DOS commands from Visual Basic?

My code is something like:

Dim folderPath as String
folderPath = "C:\MyFolde r"
Shell ("md " & folderPath)


md is a resident command of command.com or cmd.exe. You must call

shell "cmd.exe /c md test"

(untested)

Instead of "cmd.exe" use environ("comspe c")

Apart from this: Why do you want to use DOS commands?
--
Armin

Nov 20 '05 #2
Hi Lou,

It must have been discouraging to have been 'ignored'. :-(

But it's very unlikely that your question would have been left unanswered
This only occurs when the topic is well outside the area of any of the many
people who answer questions here. As I can't see your question in my
newsreader (and I update frequently throughout the day), I suspect that it may
have failed to reach the server.

Regards,
Fergus
Nov 20 '05 #3
* "Amjad" <am*********@ho tmail.com> scripsit:
I'm trying to create a folder, append text file to
another, and delete files using the "Shell" command. But
I always get the error "File Not Found".

How do I use DOS commands from Visual Basic?

My code is something like:

Dim folderPath as String
folderPath = "C:\MyFolde r"
Shell ("md " & folderPath)


<http://www.mvps.org/dotnet/dotnet/samples/miscsamples/downloads/RedirectConsole .zip>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
* "Armin Zingler" <az*******@free net.de> scripsit:
How do I use DOS commands from Visual Basic?

My code is something like:

Dim folderPath as String
folderPath = "C:\MyFolde r"
Shell ("md " & folderPath)


md is a resident command of command.com or cmd.exe. You must call

shell "cmd.exe /c md test"

(untested)

Instead of "cmd.exe" use environ("comspe c")

Apart from this: Why do you want to use DOS commands?


DOS commands or "command shell" commands...

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
*Amjad* tippselte am *21.10.2003 15:50* MESZ:
I'm trying to create a folder, append text file to
another, and delete files using the "Shell" command. But
I always get the error "File Not Found".

How do I use DOS commands from Visual Basic?


VB.NET, you meant, right?

However, I think the easiest method is to write all commands to a
temporary batch file and then call the batch file. This has also the
advantage that you can check out easily the contents of the batch file
and see what the operating system does.

Best regards,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 20 '05 #6
* Michael Kremser <us************ ****@aon.at> scripsit:
I'm trying to create a folder, append text file to another, and
delete files using the "Shell" command. But I always get the error
"File Not Found". How do I use DOS commands from Visual Basic?


VB.NET, you meant, right?

However, I think the easiest method is to write all commands to a
temporary batch file and then call the batch file. This has also the
advantage that you can check out easily the contents of the batch file
and see what the operating system does.


Mhm... I prefer redirecting the command shell and execute the commands
against it directly.

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> schrieb

Apart from this: Why do you want to use DOS commands?


DOS commands or "command shell" commands...

;-)


??
--
Armin

Nov 20 '05 #8
* "Armin Zingler" <az*******@free net.de> scripsit:
Apart from this: Why do you want to use DOS commands?


DOS commands or "command shell" commands...

;-)


??


In Windows NT, there are no DOS commands any more.

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #9
* "Armin Zingler" <az*******@free net.de> scripsit:
> Apart from this: Why do you want to use DOS commands?

DOS commands or "command shell" commands...

;-)

??


In Windows NT, there are no DOS commands any more.

;-)


Really? I could swear I've been using them. :)


;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #10

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

Similar topics

0
1516
by: Art Werschulz | last post by:
Hi. I am running MacOS X 10.3.1 (Panther) on a G4 iMac. I am installing some Perl modules using the CPAN shell, i.e., I issue the command # perl -MCPAN -e shell and then type commands to the cpan> prompt. When I have done this on a Linux box, the .cpan directory is placed in root's home directory /root, and the manified documentation goes into /usr/share/man/man3. To me, this seems pretty reasonable.
5
24155
by: Bill | last post by:
I used to be able to run the following ASP code on our corp machine (W2K Server Edition and IIS-5) and successfully send a net-msg to anyone on our intranet. Last week it stopped working... and I'm not sure what changed. (I had applied ALL the W2K update patches... but... I'm not sure if the problem started before or after that.) Did any recent W2K patches change the way createObject, wScript.shell, or "NET SEND" works?
3
2846
by: MLH | last post by:
Where would I go to find a list of the possible return values for X and their implication when launching.. X=Shell("C:\Windows\wordpad.exe c:\cr\docs\packets\ntrolttr.rtf", 1) ???
2
19281
by: Mike John | last post by:
I am trying to use the shell object to send keys to the explorer browser to run the send page funcion. I am receiving the above error only when I put my html file in the web server folder.However if I am runing the file local it will work Any reason, why when the file is in the web server folder the create object failed to created the shell object. Systax:
2
4981
by: Hexman | last post by:
Hello All, I receive many files with similar content each day. All I want to do is copy them into one file, then I'll use that file for my processes. Using vb2005. I've tried: Shell("copy c:\CND\dr*.txt C:\CND\TestC.txx") That comes back with "File not found". There are files there! Tried:
1
1836
by: Stinky Pete | last post by:
Hi, With thanx to the group and suggestions to review other news sites, I've got some code that allows me to open Adobe from Access. As I am new at this, I still need some help though. The code to get Abobe to open is working really well, however the referenced file I need is not being opened. I've tried the path that I've got in the text box via the cmd prompt and copying the path in Windows Exp and the path does work. Any...
4
12034
by: uinoma | last post by:
I want to open notepad in fullscreen mode, but this script that I created can't do that. . When I open Windows Manager Task, the program is just run in background, not appeared on web server dekstop. Is the script wrong or missing something? Please check out this script and give me your ideas. <? $WshShell = new COM("WScript.Shell");
3
4819
by: ManningFan | last post by:
Due to the way our IT group has set up our servers, we are not allowed to use the Shell() command. We are already doing a similar action with an FTP command. Our code is thus: sExe = Environ$("COMSPEC") sExe = Left(sExe, Len(sExe) - Len(Dir(sExe))) sExe2 = sExe & "ftp.exe -s:" & Q & sScrFile & Q
0
2700
by: edurran | last post by:
Hi all, I have spent the last three days on this problem. Looked in many forums and not found the answer as yet. Hopefully ye can help. I have two functions. One works fine, the second does not. First Function Function try1 SET objShell = CreateObject("Wscript.Shell")
0
9643
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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
10147
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...
0
8971
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...
1
7496
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4046
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
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.