Computing.Net > Forums > Programming > run dos command in vb

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

run dos command in vb

Reply to Message Icon

Name: frank
Date: October 29, 2001 at 00:26:32 Pacific
Comment:

Hi;
I want to write vb login screen and it will run a dos command.
for example :
login ID : a
password : b
c is a fix value
after press ok button will be process a dos command X+a+b+c

Can u help me ?
Thank you

Frank



Sponsored Link
Ads by Google

Response Number 1
Name: Joythi Prakash
Date: October 30, 2001 at 01:44:36 Pacific
Reply:

Hi

Can you try SHELL command

Thanks

Joythi


0

Response Number 2
Name: shabdar
Date: January 26, 2002 at 21:37:50 Pacific
Reply:

you can't run every dos command using shell

for ecample dir

OCX should be such that it returns output of the command.

can anyone help me regarding this ?

shabdar


0

Response Number 3
Name: jagdish kotian
Date: March 31, 2002 at 23:45:59 Pacific
Reply:

I want to excecute dos command in visal basic . Dos command is dir >> file1.txt


0

Response Number 4
Name: Niklas Kökeritz
Date: April 5, 2002 at 05:37:26 Pacific
Reply:

Try this

--
Dim taskID as Double
taskID = Shell("C:\winnt\system32\cmd /C dir > file1.txt", 0)
--

Should work in NT4 and W2K.

The return value [taskID] is a handle to the aplication started, in this case it can safely be ignored.

[cmd] is windows interpretator for classical command line DOS and [C:\winnt\system32\] is the path to it.

The switch [/C] tells cmd to run the input string and then exit.

[dir > file1.txt] is the DOS command and thus the input string to cmd.

The last argument, [0], hides the new window that shell starts for the external application.

To locate the output file, use [App.Path] to find out in which directory it ended up.

Good luck


0

Response Number 5
Name: Niklas Kökeritz
Date: April 5, 2002 at 06:20:02 Pacific
Reply:

This a much better solution to the above problem:

taskID = Shell(Environ$("Comspec") & " /c dir > file1.txt", 0)


0

Related Posts

See More



Response Number 6
Name: Raghvendra
Date: April 5, 2002 at 20:29:00 Pacific
Reply:

i run ping command on sql mode by help $
e.g. $ping 172.16.8.1

then i find the particular server link is down or not .


i want to store the result of ping command on database by using VB or c++.


plz explain the way by which i can do this ?


0

Sponsored Link
Ads by Google
Reply to Message Icon

ROUTINE CALLS? COBOL complier



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: run dos command in vb

Update command in VB.NET www.computing.net/answers/programming/update-command-in-vbnet/3989.html

DOS commands in C www.computing.net/answers/programming/dos-commands-in-c/9449.html

How do I do passwords in VB. www.computing.net/answers/programming/how-do-i-do-passwords-in-vb/2480.html