Use Viusal Basic Command Operating Directory Analysis

xiaoxiao2021-03-06  39

1. Create a new directory or folder to implement this step we can use the MKDIR statement in VB. Format: MKDir path: Create a new directory and file description: Path Specifies the string expression of the directory or folder you want to create. Path can include a drive. If no drive is specified, MKDIR creates a new directory or folder on the current drive. If the specified directory or folder already exists, you will generate an error. For example: mkdir "C: / windows / 100" align = "Right" marginwidth = "0" marginheight = "0" src = "http://images.chinabyte.com/adjs/iframe-pip/y-software-pip .html "frameborder =" 0 "width =" 360 "scrolling =" no "height =" 300 ">

2. Modifying a NAME statement in VB to implement these features in VB. Format: Name OldPathname As NewPathName Ren: From Name a file, directory, or folder. Description: OldPathName string expressions, specify existing file names and locations, can contain directory or folders, and drive names. NewPathName string expressions, specify new file names and locations, can contain directory or folders, and drive names. And OldPathName and NewPathName must be on the same drive. If the path specified by NewPathName exists but is different from the path specified by OldPathName, the Name statement moves the file to a new directory or folder, and will be named from the new name when necessary. If the newpathname and the oldpathname path are different, then Name The file will only be moved to the new location and keep the file name unchanged. The Name statement can move the file from a directory or folder to another, but cannot move the directory or folder. And cannot be on a file already opened Using Name, an error will occur. Therefore, before changing the name, you must turn the file. Name (*) and single-character (?) Wildcards. For example: Name "C: / Windows / 100" AS "C: / Windows / 200" 3, delete the directory for deleting directories, we can use RMDIR statement format: RMDir path effect: Delete a directory or folder. Description: PATH Specifies the string expression of the directory or folder you want to delete. Path can include a drive. If no drive is specified, RMDIR will delete a directory or folder on the current drive. An error occurs if you want to use RMDir to delete a directory or folder that contains files. Only after using the KILL statement to delete all files to use RMDIR to delete the directory or folder. For example: RMDIR "C: / Windows / 200" here we will give an example to see how all subdirectories under a file rack. The following is the source code:

转载请注明原文地址:https://www.9cbs.com/read-51658.html

New Post(0)