如何根据复制的文本创建新文件夹 [英] How to create new folder based on the copied text
问题描述
这是我在网站上的第一个问题。
这是我工作的GIF
我在电报APP上使用有效的手机号码。
https://media.giphy.com/media/3ornkbjxXTVIGdfp4c/giphy.gif [ ^ ]
就像你在GIF中看到的那样,我必须移动tdata文件夹并将其发送到一个zip,然后用我正在处理的手机号码重命名zip文件。
我已经有了一个.bat文件,它可以将tdata文件夹移动到channels文件夹并将其发送到ZIP,并将其命名为+20然后重命名它并粘贴我复制的手机号码。
现在我需要一个命令来创建我已复制的手机号码的ZIP文件
我尝试了什么:
这是我的.bat文件
it's my first question here on the website.
this is a GIF from my work
i'm work on active mobile numbers on telegram APP.
https://media.giphy.com/media/3ornkbjxXTVIGdfp4c/giphy.gif[^]
Like you can see in the GIF, i have to move the "tdata" folder and send it to a zip, then rename the zip file by the mobile number i'm working on.
i'm already have a .bat file that it works on move the "tdata" folder to the channels folder and sends it to the ZIP, and give it name "+20" then i rename it and paste the mobile number i have copied.
now i need a command to create the ZIP file with the mobile number i have copied
What I have tried:
this is my .bat file
mkdir C:\Users\elamy\Desktop\Telegram\Channels\tdata
rd "C:\Users\elamy\Desktop\Telegram\tupdates" /s /q
del "C:\Users\elamy\Desktop\Telegram\log.txt" /s /q
move "C:\Users\elamy\Desktop\Telegram\tdata" "C:\Users\elamy\Desktop\Telegram\Channels\tdata\tdata"
"C:\zipper.vbs" "C:\Users\elamy\Desktop\Telegram\Channels\tdata" "C:\Users\elamy\Desktop\Telegram\Channels\+20.zip"
rd "C:\Users\elamy\Desktop\Telegram\Channels\tdata" /s /q
and this is the .vbs zipper file
Set Args = Wscript.Arguments
source = Args(0)
target = Args(1)
' make sure source folder has \ at end
If Right(source, 1) <> "\" Then
source = source & "\"
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set zip = objFSO.OpenTextFile(target, 2, vbtrue)
' this is the header to designate a file as a zip
zip.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
zip.Close
Set zip = nothing
wscript.sleep 500
Set objApp = CreateObject( "Shell.Application" )
intSkipped = 0
' Loop over items within folder and use CopyHere to put them into the zip folder
For Each objItem in objApp.NameSpace( source ).Items
If objItem.IsFolder Then
Set objFolder = objFSO.GetFolder( objItem.Path )
' if this folder is empty, then skip it as it can't compress empty folders
If objFolder.Files.Count + objFolder.SubFolders.Count = 0 Then
intSkipped = intSkipped + 1
Else
objApp.NameSpace( target ).CopyHere objItem
End If
Else
objApp.NameSpace( target ).CopyHere objItem
End If
Next
intSrcItems = objApp.NameSpace( source ).Items.Count
wscript.sleep 250
' delay until at least items at the top level are available
Do Until objApp.NameSpace( target ).Items.Count + intSkipped = intSrcItems
wscript.sleep 200
Loop
'cleanup
Set objItem = nothing
Set objFolder = nothing
Set objApp = nothing
Set objFSO = nothing
推荐答案
你无法得到文本直接来自剪贴板。你必须使用一些技巧。检查一下:如何在vbscript中使用剪贴板? - 堆栈溢出 [ ^ ]
如需了解更多信息,请参阅:
一个vb脚本函数,用于从windows剪贴板获取文本数据 [ ^ ]
You can't get the text directly from clipboard. You have to use some trick. Check this: How can I use Clipboard in vbscript? - Stack Overflow[^]
For further informaiton, please see:
A vb script function to get text data from the windows clipboard[^]
这篇关于如何根据复制的文本创建新文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!