2016-08-10 5 views
1

다음과 같은 문제가 있습니다. 나는 Windows 12 USB 플래시 드라이브와 12 포트 허브를 통해 연결하고 있습니다. 사용자가 두 번 클릭하고 특정 폴더의 모든 파일을 바탕 화면의 만들어진 폴더로 다운로드 할 수있는 스크립트를 작성 중입니다. 그것을 보편적으로 만들기 위해 사용자는 자신의 Windows 사용자 이름과 Windows 파티션 문자를 입력하게합니다. 그리고 나서 (지금 현재) 나는 사용자에게 모든 드라이브를 하나씩 12 글자로 타이핑 할 것을 요구하고 있습니다. 필자는 사용자가 드라이브의 첫 번째 문자를 입력 한 다음 11 개의 나머지 드라이브에 대한 문자를 자동으로 생성하기 때문에 드라이브가 첫 번째 문자에 따라 적절한 문자 순서로 마운트되는 경우 항상 그렇습니다.VBS 연결된 USB 플래시 드라이브에 연속 문자를 생성하는 방법

코드에서 볼 수 있듯이 ascii로 변환하고 문자로 돌아가려고했지만 작동하지 않고 이해하거나 구현할 수있는 다른 것을 찾을 수 없습니다.

나는 충분히 명확하고 도움을 위해 미리 감사드립니다.

DIM fso 
Set fso=CreateObject("Scripting.FilesystemObject") 
On Error Resume Next 

Set oDrive = fso.Drives 

username = InputBox("Enter winows user name") 
wl = Inputbox("Enter Your windows partition drive letter") 


l0 = Inputbox("Enter Your 1st camera drive letter") 
'l1 = Inputbox("Enter Your 2nd camera drive letter") 
'l2 = Inputbox("Enter Your 3rd camera drive letter") 
'l3 = Inputbox("Enter Your 4th camera drive letter") 
'l4 = Inputbox("Enter Your 5th camera drive letter") 
'l5 = Inputbox("Enter Your 6th camera drive letter") 
'l6 = Inputbox("Enter Your 7th camera drive letter") 
'l7 = Inputbox("Enter Your 8th camera drive letter") 
'l8 = Inputbox("Enter Your 9th camera drive letter") 
'l9 = Inputbox("Enter Your 10th camera drive letter") 
'l10 = Inputbox("Enter Your 11th camera drive letter") 
'l11 = Inputbox("Enter Your 12th camera drive letter") 


fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam0" 
fso.CopyFile ""& l0 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam0\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam1" 
'fso.CopyFile ""& l1 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam1\" 
fso.CopyFile "Chr(Asc('"& l0 &"') + 1):\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam1\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam2" 
fso.CopyFile ""& l2 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam2\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam3" 
fso.CopyFile ""& l3 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam3\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam4" 
fso.CopyFile ""& l4 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam4\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam5" 
fso.CopyFile ""& l5 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam5\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam6" 
fso.CopyFile ""& l6 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam6\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam7" 
fso.CopyFile ""& l7 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam7\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam8" 
fso.CopyFile ""& l8 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam8\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam9" 
fso.CopyFile ""& l9 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam9\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam10" 
fso.CopyFile ""& l10 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam10\" 

fso.CreateFolder ""& wl &":\Users\"& username &"\Desktop\recording\cam11" 
fso.CopyFile ""& l11 &":\DCIM\100HDDVR\*.*", ""& wl &":\Users\"& username &"\Desktop\recording\cam11\" 


Wscript.Echo "File copy complete." 

답변

1

사용 Asc()/Chr()를 숫자와 문자 사이의 변환 : (필자는 아스키 변환을 수행 할 때)

는 코드입니다. 'Z에서 멈춤'을 확인하십시오. 예 :

>> Function min(a, b) : If a <= b Then : min = a : Else : min = b : End If : End Function 
>> For Each d In Split("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z") 
>>  a = Asc(d) 
>>  WScript.Stdout.Write d & " " & a & ":" 
>>  For i = a To min(Asc("Z"), a + 11) 
>>   WScript.Stdout.Write " " & Chr(i) 
>>  Next 
>>  WScript.Stdout.WriteLine 
>> Next 
>> 
A 65: A B C D E F G H I J K L 
B 66: B C D E F G H I J K L M 
C 67: C D E F G H I J K L M N 
D 68: D E F G H I J K L M N O 
E 69: E F G H I J K L M N O P 
F 70: F G H I J K L M N O P Q 
G 71: G H I J K L M N O P Q R 
H 72: H I J K L M N O P Q R S 
I 73: I J K L M N O P Q R S T 
J 74: J K L M N O P Q R S T U 
K 75: K L M N O P Q R S T U V 
L 76: L M N O P Q R S T U V W 
M 77: M N O P Q R S T U V W X 
N 78: N O P Q R S T U V W X Y 
O 79: O P Q R S T U V W X Y Z 
P 80: P Q R S T U V W X Y Z 
Q 81: Q R S T U V W X Y Z 
R 82: R S T U V W X Y Z 
S 83: S T U V W X Y Z 
T 84: T U V W X Y Z 
U 85: U V W X Y Z 
V 86: V W X Y Z 
W 87: W X Y Z 
X 88: X Y Z 
Y 89: Y Z 
Z 90: Z 
>> 
+0

안녕하세요! 귀하의 의견을 보내 주셔서 감사합니다. 나는 그것을 완전히 이해하지는 못한다. 변환하는 데 Asc()/Chr()을 사용하려고했지만 행운이 없었습니다. 아니면 전환을 위해 게시 한 배열이 필요합니까? 나는이 권리를 얻고 있는가? – Bart