php editor Baicao will tell you how to create a new vbs file on Mac. Although vbs files are typically used on Windows systems, they can also be created and run on Mac. To create a new vbs file on Mac, you can use the tool WineBottler to simulate the Windows environment. First, you need to download and install WineBottler. After the installation is complete, open WineBottler, click the "Advanced" tab on the left, and then click the "Run Command" button on the right. In the pop-up window, enter "notepad" and click the "Run" button. This will open a text editor similar to Notepad. In the text editor, enter the vbs code you want, and then click the "Save" option in the "File" menu to save the file in .vbs format. In this way, a new vbs file is successfully created on Mac.
1. Directory.Delete(D:\NetEase\Test1, True) deletes the subdirectory Test2. Dim myDirectoryInfo As New DirectoryInfo(D:\NetEase\Test2)myDirectoryInfo.Delete(True) Delete all files and subdirectories in directory C:\AlexDirDemo and below.
Use the dir command to search all files in the folder and save the results to a text file. Then use the findstr command to search the text file for files with version number 0 and save the results to another text file.
3. First use Regread to obtain the path, such as: Path1=RegRead "registry location.
4. Quit is the same way. You may not be able to delete it successfully using fso.DeleteFolder(VBSFolder) folder, the reason may be a problem with the current directory. You can try to switch to another directory under the cmd command line, and then call the VBS file written by this method to test whether the folder can be successfully deleted. But if you double-click the VBS file directly , the folder may not be deleted successfully.
You can use the GetFolder object to bind the folder and return the file properties to filter out the files of interest. For example, you can list all files and file extensions, and Count the number of files with the suffix .doc. Use WMI to create more target queries.
The code calls different processes through a loop to traverse the folder and its subfolders. Determine whether the file is a .bak file. And delete it.
createfolder method When creating a directory, the upper directory must exist. For example, create c:\1\2, If there is no directory 1 under the c drive, an error will occur (directory 2 will not be created).
Call: The computer uses functions to execute commands when programming or running. The function body is executed by calling the function, unlike other languages The subroutine call is similar.
Although the code works, there are some characters in the date and time format that are not suitable for folder or file names. For example, English slash (/) and English colon (:). So I fine-tuned the final format so that it works for naming.
set S = WScript.CreateObject(WScript.Shell) set lnk = S.CreateShortcut(D:\Batch\xxx.lnk) lnk.TargetPath = F:\XXX.batlnk.Save The above is the vbs code.
You must ensure that this path (F:\Automation\vbs\test) exists before you can create text.
1. vbs is a script file. Edit it directly in the txt text document, and just change the name to xxx.vbs when saving.
2. Create a new text document, such as a new text document; you cannot see the suffix of the file at this time, and you need to modify the suffix of the file.
3. Create a text document first, then write the code into it, and then click File, save as, enter the file name .vbs in the file name, and confirm.
4. Set oShell=CreateObject(Wscript.Shell)oShell.RegWrite HKLM\Software\Microsoft\Windows\CurrentVersion\Run \window, c:\windos\window.vbs, just change the following c:\windos\window.vbs to your file path.
Conclusion: The above is all the content of the new vbs file on mac introduced by this site. I hope it will be helpful to everyone. If you want to know more about this, remember to bookmark and follow this site. .
The above is the detailed content of Create a new vbs file on mac?. For more information, please follow other related articles on the PHP Chinese website!