China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 13:50
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » VBS: How to handle directories with dots View 1,850 Replies 1
Original Poster Posted 2010-12-28 21:14 ·  中国 湖南 常德 电信
初级用户
★★
Credits 66
Posts 53
Joined 2009-10-09 20:51
16-year member
UID 152852
Gender Male
Status Offline
For example, a malformed directory with a dot, such as: MD C:\Folder...\ ,in CMD it is displayed as C:\Folder..

Using GetFolder in VBS is invalid:

set sh=CreateObject("Wscript.Shell")
set FSO=CreateObject("Scripting.FileSystemObject")
For each i in Wscript.Arguments
Set FO=FSO.GetFolder( i ) 'This step often goes wrong, can't find the path
Sh.Run "Explorer " & FO.ShortPath 'Open with the short path of the directory
Next

[ Last edited by wewebb on 2010-12-28 at 21:19 ]
Floor 2 Posted 2010-12-29 09:54 ·  中国 北京 263网络通信电信数据中心
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Can't this work directly?
Sh.Run "Explorer " & i & "." 'Open with short path of directory method
S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore
Forum Jump: