Opening file in vbs

May 29, 2010 at 09:24:34
Specs: Windows 7, 4 gbs
I started making this vbs file..

Dim intResponse As Integer

intResponse = MsgBox("Your Pc has found a virus," & Chr(13) & "would you like to remove it?",4+48,"Windows 7")

If intResponse = 6 Then


If intResponse = 7 Then

I want to open a file if the person clickes yes (6) or open a different file if no (7). Can someone please help me how to do this?

See More: Opening file in vbs

Report •

May 29, 2010 at 13:29:57
If you mean open a text file, then easiest way is prob'ly
filesystemobject, but you have to decide on a mode:input
(1), output (2), or append (3). This one uses input mode:
dim fso
set fso=createobject("scripting.filesystemobject")
If intResponse = 6 Then fname="fileA"
If intResponse = 7 Then fname="fileB"
if fname="" then wscript.quit
set ifile=fso.opentextfile(fname,1)
do while not ifile.atendofstream
wscript.echo x
'------ end
ps: there's a really handy download at MSDN: script56.chm
has all the commands and syntax, cscript AND jscript.

Report •

June 1, 2010 at 05:11:44
I am confused can you make the whole file? I want it to open a file called yes for yes and no for no? Can you just fill in whats missing cause idk where it goes...

Report •

June 1, 2010 at 13:25:08
I got it its worlking now but in yes it was yes.vbs it opened it but heres what i wanted to happen msgbox("Your PC is removing the virus...",0,"Windows 7")----That to be the begining. it stead of popping up with a pop up thath says that the pop say "msgbox("Your PC is removing the virus",0,"Windws 7") It says quoets () and everything? Can you help with thayt

Report •

Related Solutions

Ask Question