VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



all kinds of cool ways of using the shell command

by Half-Dead (5 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (18 Votes)

These different ways of using the shell command will let you : Launch files without knowing the associated program(doc,bmp,zip,etc), copy files and complete directories, run dos commands, launch a browser, launch an email client with almost all fields prefilled(including body!) and loads of stuff you might think of.

Side Effects
You dont get any feedback from VB to check if the operation went well, so use this only for stuff that you are sure about, and dont need error codes returned.

Rate all kinds of cool ways of using the shell command

'The vbhide makes sure that ppl dont see that ugly dosbox
Shell ("c:\windows\command\xcopy /e /i /r c:\temp d:\NewTemp"), vbHide
' will create a directory called NewTemp on d: and copy
' all the files and directories recursively from c:\temp
' into it, without showing the dosbox
' you can also run any commands like del, dir, etc
' by running command.com
shell("command.com /c PathandFileToRun Commuters CommandLine"), vbHide
' /c tells command.com to run a command and exit
' you could run somethin like :
Shell ("command.com /c dir /b d:\ > dListing.txt"), vbHide
' and recover all the names of the files in d:
' or run files associated to programs(doc,zip,bmp,etc)
' by using the start command, windows will launch the
' file with the appropriate program
Shell ("start C:\WINDOWS\HELP\WINHLP32.HLP"), vbHide
' if you need even more dos power then you could just as easily run
' some bat files to do bigger operations. I think
' windows scripting host can do some awesome stuff too
' but im not familiar with it at all. All i know is
' that it lets you write javascript and vbscript like
' batch files.
Shell ("start http://www.whatever.com"), vbHide
'Will launch the default webrowser on that page

Shell ("start mailto:[email protected],[email protected][email protected]&subject=whatever&body=your text"), vbHide
'launch the default email client with most fields prefilled.
'im sure you can attach a file, but i havent found the right
'command yet. also its VERY important the order in which the
'commands are fed. Just separate multiple adresses with a comma
'like above.
'if i find any other cool usages i'll postem up.

Download this snippet    Add to My Saved Code

all kinds of cool ways of using the shell command Comments

No comments have been posted about all kinds of cool ways of using the shell command. Why not be the first to post a comment about all kinds of cool ways of using the shell command.

Post your comment

Subject:
Message:
0/1000 characters