borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (VB- MODEMS)Next Topic (Registry) New Topic New Poll Post Reply
AndreaVB Forum : VB General : about cmd.exe
Poster Message
nokmaster
Level: Trainee

Registered: 01-08-2005
Posts: 2

icon about cmd.exe

hello anyone can help me with my project?
this about cmd.exe and sendkeys

actually this code is already working but
my problem is how to capture this cmd.exe into textfile...

lets say in C:\dir - u will see the directory right?
i want the history will be saved automatically into textfile

Thanks...

br,

01-08-2005 at 11:44 AM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: about cmd.exe

Hi

dir *.* -u >>dir.txt



This will send the output to a file called dir.txt


Steve  

01-08-2005 at 12:16 PM
View Profile Send Email to User Show All Posts | Quote Reply
nokmaster
Level: Trainee

Registered: 01-08-2005
Posts: 2
icon Re: about cmd.exe

thanks...

sir, take a look with my code


cmdGenerate.Enabled = False
txtSerialNumber.Text = ""
txtDummy.Visible = False
txtExit.Visible = False
CShell = Environ("COMSPEC")
O = Shell("CShell -u >> C:\data.txt", vbNormalFocus)


is this correct? i got an error...

i want to capture the dummy.exe output into data.txt
Thanks...

03-08-2005 at 08:50 AM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: about cmd.exe

well... I believe the "CShell" needs to be outside the quotes... the way you have it, it'll execute "CShell"

What that will do, once fixed is go to a command prompt, and possibly load a second command prompt (not sure though).

Regardless though, you haven't run the program that you're wanting to intercept...

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

03-08-2005 at 08:18 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: about cmd.exe

JL is right you going to open another dos window. It would be easier to create a batch file to do what you want, then you can shell that command.

For example

Create a file called dircopy.bat,

Put the command dir /o-d >>c:\data.txt

save it in the root.

Then in your vb app

Shell "c:\dircopy.bat"

Steve  

04-08-2005 at 09:25 AM
View Profile Send Email to User Show All Posts | Quote Reply
mozzy
Level: Graduate

Registered: 02-08-2005
Posts: 11
icon Re: about cmd.exe

Hi everybody,

I'm new to this forum. I was searching for somehting on the internet and came across this site and it looks pretty good.

I think this is what you are looking for,

Shell "command.com /c dir *.* -u >> dir.txt", vbHide

Writes the dir listing of the specified directory and then exits the command prompt.

05-08-2005 at 09:25 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : about cmd.exe
Previous Topic (VB- MODEMS)Next Topic (Registry) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder