다른 디렉토리에 압축 파일 묶음 (.ARJ)을 자동으로 추출하려고합니다. _Work_Splunk_TestBed \ Branch00 \ LOAN.ARJ : D - 압축 파일 (ARJFileNames.txt) 샘플의텍스트 파일에서로드 된 문자열을 사용하여 외부 명령 실행
- 현재 위치와 이름 :
나는 현재 정보의 2 비트를 저장하기 위해이 개 텍스트 파일을 사용하고 있습니다
- 파일이 (ARJFileLocations.txt) 샘플을 추출하기위한 대상 위치 - D : _Work_Splunk_TestBed \ Branch00
나는 W를 실행하는 WScript.Shell
명령을 사용하려고 inRAR을 사용하여 현재 위치에서 대상 위치로 파일을 추출합니다.
내 문제는 루프에서 외부 명령을 호출 할 때 텍스트 파일에서 끌어 오기 문자열을 첨부 할 수없는 것처럼 보입니다. 실제로 WinRar 및 해당 스위치에 대한 호출과 함께 사용합니다. 명령.
'Declaring Constants
Const ForReading = 1, ForWriting = 2, ForAppending = 3
'Declaring Variables
Dim fso, strFilePath, strFileName, fFilePath, fFileName, objShell, WinRAR, strCMD, SevenZip, ARJ
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject ("WScript.shell")
'Open Text Files for use
Set strFilePath = fso.OpenTextFile("D:\_Work\_Splunk\_TestBed\ARJFileLocations.txt", ForReading, TristateFalse)
Set strFileName = fso.OpenTextFile("D:\_Work\_Splunk\_TestBed\ARJFileNames.txt", ForReading, TristateFalse)
Do Until strFilePath.AtEndOfStream
fFilePath = strFilePath.ReadLine 'Get the location of the ARJ file
fFileName = strFileName.ReadLine 'Get the target location for ARJ file contents
'Storing the command as 1 string'
strCMD = "winrar x -y " & " " & fFileName & " " & fFilePath
'Running the command in CLI'
objShell.Run strCMD
Loop
'Cleaning Up
Set strFilePath = Nothing
Set strFileName = Nothing
Set objShl = Nothing