|
-
Oct 2nd, 2003, 10:00 PM
#1
Thread Starter
New Member
Unable to execute non .Exe files
Im currently writing up a small app to manage a bunch of script files and a few things. However, using the Shell command does nothing as it only runs other .EXE files.
I'd like to know how to make VB open up other non .exe files. In other words, if i tell VB to open up a .bmp or .txt or whatever, it'll simply run the program in whatever native/default program windows has it. I'd like it to be able to just run the script. I'm pretty stumped as to how to run other things.
If anyone can help, i really appreciate it, thanks in advance!
-
Oct 2nd, 2003, 10:10 PM
#2
here's a few...
VB Code:
Process.Start("C:\Documents and Settings\den\My Documents\pics\DCP_0496.jpg")
'///^^^ open a jpeg in it's default program.
Process.Start("C:\Documents and Settings\den\My Documents\Win32api.txt")
'///open a textfile in it's default prog ( eg: notepad )
Process.Start("notepad.exe", "C:\somefile.txt")
'///start notepad , with an exsisting file.
Process.Start("iexplore.exe", "http://google.com")
'///start internet explorer with a web link
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Oct 3rd, 2003, 10:30 AM
#3
Thread Starter
New Member
Thanks, that worked really well and was exactly what i needed!
Although i havent reached this milestone yet for the lilttle mini-ap im making, i have a question about allowing the executed program to be ran as a different user.
Heres what i mean; Im currently working on a small remote scripting tool for a public school to get logging and a few basic tasks done (but due to certain reasons, they are unable to use Group Policy). However, the strict restrctions placed on student accounts makes it hard to retrive an extensive log. Would there be away to allow then running script to be executed as a different user. I would prefer that the program to manage the scripts be the one to handle the supplied User/Pass to run the script instead of letting the script contain a potentially accessible account password and username.
In short, how could i invoke the RunAs feature without the window showing up (i dont need to since i'll already supply the username and password it needs) on an executed program/file.
Thanks in advance, yet again!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|