![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-02 06:50 |
48,037 topics / 350,122 posts / today 2 new / 48,250 members |
| DOS批处理 & 脚本技术(批处理室) » VBS cannot copy folders with spaces to system variables |
| Printable Version 1,491 / 7 |
| Floor1 xg911335 | Posted 2006-10-20 03:57 |
| 初级用户 Posts 50 Credits 134 | |
|
On Error Resume Next
Dim objFSO,oShell Const OverwriteExisting = True Set objFSO = CreateObject("Scripting.FileSystemObject") Set oShell = WScript.CreateObject("WScript.Shell") objFSO.Copyfolder "aa 12" , “%USERPROFILE%\My Documents" , OverwriteExisting oShell.Run "1.exe" [ Last edited by xg911335 on 2006-10-20 at 03:59 ] |
|
| Floor2 electronixtar | Posted 2006-10-20 04:07 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Remember that %USERPROFILE% seems to be under DOS, and in VBS, you need to use Environment to get the environment variable
|
|
| Floor3 xg911335 | Posted 2006-10-20 05:06 |
| 初级用户 Posts 50 Credits 134 | |
|
Give an example to have a look. Thanks to the solution from the upstairs.
|
|
| Floor4 electronixtar | Posted 2006-10-20 07:01 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Just go to script56.chm to see
|
|
| Floor5 3742668 | Posted 2006-10-20 07:28 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
There are not many VBS scripts in the forum. But if you go through them all, the owner's problem will no longer be a problem.
Reference link: SendTo + Batch Processing Practical Small Tool - Enhanced Send To In VBS, you can also get some system directories using Wscript.Shell, but since its content is too little, I rarely use it: The directories it can get are:
In addition, regarding obtaining environment variables, you can try to implement it using WMI: Templates |
|
| Floor6 lxmxn | Posted 2006-10-20 07:38 |
| 版主 Posts 4,938 Credits 11,386 | |
|
The version master is really powerful. Learned. |
|
| Floor7 electronixtar | Posted 2006-10-20 09:05 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Shell.Application……Using this is enough to handle all paths.
[ Last edited by electronixtar on 2006-10-21 at 04:31 ] |
|
| Floor8 xg911335 | Posted 2006-10-21 03:15 |
| 初级用户 Posts 50 Credits 134 | |
|
Thanks to all for your guidance.
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |