中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-08 09:51
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 局域网文件传输批处理的实现 查看 1,005 回复 3
楼 主 局域网文件传输批处理的实现 发表于 2007-12-16 13:05 ·  中国 四川 德阳 联通
初级用户
积分 51
发帖 24
注册 2007-09-18 17:11
18年会员
UID 97711
性别 男
状态 离线
没有事做了一个小批处理文件传输的工具,希望指正或有没有更好的办法实现!!!



@echo off
mode con cols=50 lines=15
setlocal enabledelayedexpansion
title 复制脚本
set /p psw=Enter Password:
if not "%psw%" == "56697001" goto endeof
:restart
cls
set/p answer=请输入作业的路径:
if "%answer%" == "" set answer=F:\Access 2003\SS\c
set/p answer1=要传输的路径:
if "%answer1%" == "" set answer1=Documents and Settings\Student\桌面\
set/p answer2=作为IPC$连接的用户名:
if "%answer2%" == "" goto error
set/p answer3=作为IPC$连接的用户的密码:
if "%answer3%" == "" goto error
:sss
for /f "eol=; tokens=* delims=" %%i in (Computer) do (
echo 正在向%%i复制
net use \\%%i\ipc$ "%answer3%" /user:"%answer2%" 1>nul 2>nul
if not exist "\\%%i\c$\%answer1%\*.*" xcopy "%answer%" "\\%%i\c$\%answer1%" /e /y /c /F
net use \\%%i\ipc$ /del 1>nul 2>nul


)
set/p w1=是否还要再复制一遍:
if "%w1%" == "Y" set w1 = "y" else goto endeof
if "%w1%" == "y" (goto sss) else goto endeof
:error
echo.
echo.
echo 用户名或密码错误!!! & ping -n 2 127.1>nul & goto restart

点击这里下载批处理文件

[ Last edited by lzmuhioin on 2007-12-16 at 01:25 PM ]
2 发表于 2007-12-16 13:29 ·  中国 四川 德阳 联通
初级用户
积分 51
发帖 24
注册 2007-09-18 17:11
18年会员
UID 97711
性别 男
状态 离线
自己写出这个也是为了能向两位版主讨教更好的办法!!!在这个地方让我学到了不少的东西!!!!
3 发表于 2007-12-16 22:30 ·  中国 湖北 武汉 电信
版主
★★★★★
积分 11,386
发帖 4,938
注册 2006-07-23 17:10
20年会员
UID 59080
状态 离线
1、没看见“endeof”标签?
2、“if "%w1%" == "Y" set w1 = "y" else goto endeof”这句是不是错了?
4 发表于 2008-05-06 12:58 ·  中国 四川 德阳 联通
初级用户
积分 51
发帖 24
注册 2007-09-18 17:11
18年会员
UID 97711
性别 男
状态 离线
记错了,lxmxn,把endeof 改成 eof就没有问题了,主要就是执行完命令后直接跳到批处理末端
论坛跳转: