9

您好,我是新来的,我需要一个脚本来检查文件夹是否存在,然后从该文件夹中运行一个文件。如果没有,它应该将 ZIP 文件提取到特定位置。提前致谢!

4

3 回答 3

21
'Objects
Set fso = CreateObject("Scripting.FileSystemObject")
Set shl = CreateObject("WScript.Shell")

path="C:\SomeFolderToExist\" 'path to folder    
exists = fso.FolderExists(path)

if (exists) then 
    program="myprog.exe" 'Program name to run
    shl.Run(path & program) 'Run a program
end if

对于解压,我只能告诉你看这个:Extract files from ZIP file with VBScript

于 2013-01-02T12:18:52.813 回答
-1
Dim FILE, tmpfilepath, uniqueid As String
    uniqueid = Row.uniqueid
    tmpfilepath = "G:\Files\" + uniqueid
    If System.IO.Directory.Exists(tmpfilepath) Then
          do something
              Else
        System.IO.Directory.CreateDirectory(tmpfilepath)


    End If
于 2019-07-17T17:54:58.690 回答
-3

如果我理解正确:创建一个脚本:sudo vim script.sh

#!/bin/bash
    echo "enter your path"
    read path

    if [[ -d "$path"  ]]
            then
            echo $(sudo $path/yourprograme)
            else
            echo "enter your specific location"
            read spec
            $ mkdir -p $spec
            $ unzip yourfiles.zip -d $spec

            fi

运行 scrip.sh :sudo ./script.sh

于 2018-10-01T13:39:29.757 回答