vbscript file. How to open a .VBS file? Adding Data to a File

We hope we helped you resolve your VBS file problem. If you don't know where you can download an application from our list, click on the link (this is the name of the program) - You will find more detailed information on where to download the secure installation version of the required application.

A visit to this page should help you answer these or similar questions specifically:

  • How to open a file with a VBS extension?
  • How to convert a VBS file to another format?
  • What is the VBS file format extension?
  • What programs support the VBS file?

If, after viewing the materials on this page, you still have not received a satisfactory answer to any of the questions presented above, this means that the information presented here about the VBS file is incomplete. Contact us using the contact form and write what information you did not find.

What else could cause problems?

There may be more reasons why you cannot open a VBS file (not just the lack of a corresponding application).
Firstly- the VBS file may be incorrectly linked (incompatible) with the installed application to support it. In this case, you need to change this connection yourself. To do this, right-click on the VBS file that you want to edit, click the option "Open with" and then select the program you installed from the list. After this action, problems with opening the VBS file should completely disappear.
Secondly- the file you want to open may simply be damaged. In this case, it would be best to find a new version of it, or download it again from the same source (perhaps for some reason in the previous session the download of the VBS file did not finish and it could not be opened correctly).

Do you want to help?

If you have additional information about the VBS file extension, we will be grateful if you share it with users of our site. Use the form located and send us your information about the VBS file.

Most common cause The problem with opening the VBS file is simply the lack of appropriate applications installed on your computer. In this case, it is enough to find, download and install an application that serves files in the VBS format - such programs are available below.

Search engine

Enter file extension

Help

Clue

Please note that some encoded data from files that our computer does not read can sometimes be viewed in Notepad. In this way we will read fragments of text or numbers - It is worth checking whether this method also works in the case of VBS files.

What to do if the application from the list has already been installed?

Often an installed application should automatically link to a VBS file. If this does not happen, then the VBS file can be successfully linked manually with the newly installed application. Simply right-click on the VBS file, and then from the available list select the "Choose default program" option. Then you need to select the “View” option and find your favorite application. The entered changes must be approved using the "OK" option.

Programs that open a VBS file

Windows
MacOS

Why can't I open a VBS file?

Problems with VBS files can also have other causes. Sometimes even installing on a computer software servicing VBS files will not solve the problem. The reason for the inability to open and work with the VBS file may also be:

Inappropriate VBS file associations in registry entries
- corruption of the VBS file that we open
- VBS file infection (viruses)
- too little computer resource
- outdated drivers
- removing the VBS extension from the registry Windows systems
- incomplete installation of a program that supports the VBS extension

Fixing these issues should result in VBS files being able to open and work with ease. In case your computer still has problems with files, you need to take the help of an expert who will determine the exact cause.

My computer does not show file extensions, what should I do?

In standard system settings Windows user The computer does not see the VBS file extension. This can be successfully changed in the settings. Just go to the "Control Panel" and select "View and Personalization". Then you need to go to "Folder Options" and open "View". In the "View" tab there is an option "Hide extensions of known file types" - you must select this option and confirm the operation by clicking the "OK" button. At this point, the extensions of all files, including VBS, should appear sorted by file name.

VBS file is corrupted

If, after installing the required program from the list, you still cannot open a file with the VBS extension, the reason may be that it is damaged. The solution may be to find a new copy of the VBS file you are about to open

VBS file extension is not associated with the corresponding application

In this case, the easiest way is to use the tools built into the operating system for association of the VBS file with applications to support it. Double click on the file you cannot open - the operating system will display a list of programs that are likely to work with your VBS file. Select one of them, or indicate on the disk the location where you installed one of the offers from our list. Windows should open the VBS file using a pre-installed program.

The entry relating to the VBS file in the "Windows System Registry" has been deleted or corrupted
VBS file is infected with a virus

It may happen that computer virus filed under the VBS file. In this case, it will probably not be possible to open such a file. Download any good antivirus program and scan the VBS file. If the antivirus program detects dangerous data, this may indicate a VBS file indication.

In this article I will talk about working with files using VBS using the FSO and File objects. In principle, all the methods and properties shown here are very similar to those in the previous lesson about working with folders. I would even say that the File object is the twin brother of the Folder object. This lesson will be useful when creating a VBS stealer to steal passwords. Well, let's get started.

FSO object methods for working with files

Let me remind you again that to work we need to call FileSystemObject object. Without it, our VBS script will not work.

CopyFile— copies one or more files. It is possible to use wildcards: “*” – any number of characters and “?” – any one character.
Syntax: CopyFile(Source, Destination [, Overwrite])

  • Source— path to the file we are copying.
  • Destination- where we copy.
  • Overwrite- not a required parameter. Whether to overwrite existing files (True) or not (False). Default is True. If the copied file in the folder has the Read-Only attribute, an error occurs.

MoveFile— moves one or more files. It is possible to use wildcard characters. If the file being moved already exists or is a file in the Destination, it will throw an error.
Syntax: MoveFile(Source, Destination)

DeleteFile— Deletes one or more files. Wildcards can be used.
Syntax: DeleteFile(Filespec [, Force])

  • Filespec— Path to the file.
  • Force— Not a required parameter. Delete files with the attribute read-only (True) or not (False). Default is False.

Now let's enjoy the example:

"VBScript Lesson No. 13: "Working with Files (FSO) "file_1.vbs"******************************** ************************* Dim FSO, Text Set FSO = CreateObject("Scripting.FileSystemObject") FSO.CreateFolder "Folder with files" FSO.CreateFolder for i=1 to 9 Set Text = FSO.CreateTextFile(".\Folder with files\text_" & i & ".txt") next Text.Close MsgBox "There are 9 files and 1 folder in the created folder - Folder with files" & vbCrlf & "Now the files will be copied to the folder - Subdirectory" FSO.CopyFile ".\Folder with files\text_*", ".\Folder with files\Subdirectory", 0 MsgBox "files copied" & vbCrlf & "Now deletion will occur old files" FSO.DeleteFile ".\Folder with files\text*.txt", 1 MsgBox "Old files deleted" & vbCrlf & "Move new files back" FSO.MoveFile ".\Folder with files\Subdirectory\*.txt ", ".\Folder with files" MsgBox "Moving new files back is finished" & vbCrlf & "All files and folders are now being deleted" FSO.DeleteFolder ".\Folder with file*", 0

"********************************************************

"VBScript Lesson #13:

"Working with files (FSO)

"file_1.vbs

"********************************************************

Dim FSO , Text

FSO. CreateFolder "Folder with files"

FSO. CreateFolder ".\Folder with files\Subdirectory"

for i = 1 to 9

Set Text = FSO . CreateTextFile( ".\Folder with files\text_"& i & ".txt" )

next

Text. Close

MsgBox "9 files and 1 folder appeared in the created folder - Folder with files"& vbCrlf & "Now the files will be copied to the folder - Subdirectory"

FSO. CopyFile ".\Folder with files\text_*", ".\Folder with files\Subdirectory", 0

MsgBox "files copied"& vbCrlf & "Old files will now be deleted"

FSO. DeleteFile ".\Folder with files\text*.txt", 1

MsgBox "Old files deleted"& vbCrlf & "Moving new files back"

FSO. MoveFile ".\Folder with files\Subdirectory\*.txt", ".\Folder with files"

MsgBox "Moving new files back is finished"& vbCrlf & "All files and folders will now be deleted"

FSO. DeleteFolder ".\Folder with file*" , 0

GetBaseName— Returns the name of the specified file without extension.

GetExtensionName— Returns the extension of the specified file.

GetFileName— Returns the file name along with its extension.

GetParentFolderName— Returns the path to the specified file.

"************************************************* ******* "VBScript Lesson No. 13: "Working with Files (FSO) "file_2.vbs"************************* ******************************* Dim FSO, File1, File2, File3, File4 Set FSO = CreateObject("Scripting.FileSystemObject ") File1 = FSO.GetBaseName("C:\Papka\file.txt") File2 = FSO.GetExtensionName("C:\Papka\file.txt") File3 = FSO.GetFileName("C:\Papka\file. txt") File4 = FSO.GetParentFolderName("C:\Papka\file.txt") MsgBox File1 & vbCrlf & File2 & vbCrlf & File3 & vbCrlf & File4

"********************************************************

"VBScript Lesson #13:

"Working with files (FSO)

"file_2.vbs

"********************************************************

Dim FSO , File1 , File2 , File3 , File4

Set FSO = CreateObject("Scripting.FileSystemObject")

File1 = FSO. GetBaseName("C:\Papka\file.txt")

File2 = FSO . GetExtensionName("C:\Papka\file.txt")

File3 = FSO . GetFileName("C:\Papka\file.txt")

File4 = FSO . GetParentFolderName("C:\Papka\file.txt")

MsgBox File1 & vbCrlf & File2 & vbCrlf & File3 & vbCrlf & File4

FileExists— Checks the presence of a file. Returns True if it exists and False otherwise.

"************************************************* ******* "VBScript Lesson No. 13: "Working with files (FSO) "file_3.vbs"************************* ******************************* Dim FSO, File Set FSO = CreateObject("Scripting.FileSystemObject") File = FSO. FileExists("C:\Windows\WindowsUpdate.Log") MsgBox "The file WindowsUpdate.txt exists = " & File

"********************************************************

"VBScript Lesson #13:

"Working with files (FSO)

"file_3.vbs

"********************************************************

Dim FSO , File

Set FSO = CreateObject("Scripting.FileSystemObject")

File = FSO . FileExists( "C:\Windows\WindowsUpdate.Log")

MsgBox "The file WindowsUpdate.txt exists = "&File

GetTempName- Generates a random file name that can be used to create temporary files.

"************************************************* ******* "VBScript Lesson No. 13: "Working with Files (FSO) "file_4.vbs"************************* ******************************* Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") MsgBox FSO.GetTempName()

GetFileVersion— Returns the version of the executable file.

"************************************************* ******* "VBScript Lesson No. 13: "Working with Files (FSO) "file_5.vbs "************************* ******************************* Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") MsgBox FSO.GetFileVersion(" C:\Windows\write.exe") MsgBox FSO.GetFileVersion("C:\Program Files\WinRAR\WinRAR.exe")

"********************************************************

"VBScript Lesson #13:

"Working with files (FSO)

"file_5.vbs

"********************************************************

Dim FSO

Set FSO = CreateObject("Scripting.FileSystemObject")

MsgBox FSO . GetFileVersion("C:\Windows\write.exe")

MsgBox FSO . GetFileVersion( "C:\Program Files\WinRAR\WinRAR.exe")

GetFile- Returns a "File" object from the specified path.

"************************************************* ******* "VBScript Lesson No. 13: "Working with Files (FSO) "file_6.vbs"************************* ******************************* Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") Set File = FSO.GetFile ("C:\File.txt") MsgBox File

We are done with FSO directly and now let's move on to the “File” object

Properties of the File object for working with files

Attributes— Returns the attributes (set of flags) of the file.
For an example, see the article “” - Everything is similar, But instead "GetFolder" we use "GetFile".

DateCreated— Returns the file creation date

DateLastAccessed— Returns the date the file was last accessed.

DateLastModified— Returns the date of the last modification (Editing) of the file.

Drive— The name of the drive (the “Drive” object) on which the file is located.

Name— Returns the file name

ParentFolder- Returns the "Folder" object of the parent directory.

Path— Returns the full path to the file.

ShortName— Returns the short file name in 8.3 format

ShortPath— Returns a short path to the file in 8.3 format

Size— Returns the file size.

Type— Returns the file type.

"************************************************* ******* "VBScript Lesson No. 13: "Working with Files (FSO) "file_6.vbs"************************* ******************************* Dim FSO, File Set FSO = CreateObject("Scripting.FileSystemObject") Set File = FSO .GetFile("C:\Windows\AppCompat\Appraiser\GatedDefaultCache.bin") MsgBox "Date created - " & File.DateCreated & vbCrLf _ & "Date last accessed - " & File.DateLastAccessed & vbCrLf _ & "Date last modified - " & File.DateLastModified & vbCrLf _ & "Drive - " & File.Drive & vbCrLf _ & "File name - " & File.Name & vbCrLf _ & "Parent directory - " & File.ParentFolder & vbCrLf _ & "Path to file - " & File.Path & vbCrLf _ & "Short name 8.3 - " & File.ShortName & vbCrLf _ & "Path in 8.3 format - " & File.ShortPath & vbCrLf _ & "File type - " & File.Type & vbCrLf _ & "File size in bytes - " & File.Size

"********************************************************

"VBScript Lesson #13:

"Working with files (FSO)

"file_6.vbs

"********************************************************

Dim FSO , File

Set FSO = CreateObject("Scripting.FileSystemObject")

Set File = FSO . GetFile( "C:\Windows\AppCompat\Appraiser\GatedDefaultCache.bin")

MsgBox "Creation date - "&File. DateCreated & vbCrLf_

& "Date of last access - "&File. DateLastAccessed & vbCrLf_

If our system cannot cope with the .VBS extension and all the automatic and semi-automatic methods of teaching it this art have failed, we are left with manual editing of the Windows registry. This registry stores all information relating to our work. operating system, including connecting file extensions to programs to serve them. Team REGEDIT inscribed in the window “search for programs and files” or "launch in the case of older versions of the operating system, it gives us access to the registry of our operating system. All operations performed in the registry (even not very complex ones regarding the .VBS file extension) have a significant impact on the operation of our system, so before making any modifications, you should make sure that a copy of the current registry is made. The section we are interested in is the key HKEY_CLASSES_ROOT. The following instructions show, step by step, how to modify the registry, specifically the registry entry containing information about the .VBS file.

Step by step

  • Click “start” button
  • In the “find programs and files” window (in older versions of Windows this is the “Run” window), enter the command “regedit” and then confirm the operation with the “ENTER” key. This operation will launch the system registry editor. This tool will allow you not only to view existing records, but also to modify, add or delete them manually. Due to the fact that the Windows registry is key to its operation, all operations carried out on it should be performed judiciously and consciously. Carelessly removing or modifying an inappropriate key may permanently damage the operating system.
  • Using the ctr+F key combination or the Edit menu and the “Find” option, find the .VBS extension you are interested in by entering it in the search engine window. Confirm by pressing OK or using the ENTER key.
  • Backup copy. It is extremely important to create a backup copy of the registry before making any changes to it. Every change has an impact on the operation of our computer. In extreme cases, erroneous modification of the registry may result in the system being unable to restart.
  • The value you are interested in regarding the extension can be manually edited by changing the keys assigned to the found extension.VBS. In this place, you can also independently create the desired entry with the extension a.VBS if it is not in the registry. All available options are located in the handy menu (right mouse button) or in the "Edit" menu after placing the cursor in the appropriate place on the screen.
  • After you finish editing the entry for the .VBS extension, close the system registry. The introduced changes will take effect after restarting the operating system.