使用路径中的空格使用批处理脚本复制文件
我想将所有 *.jar 文件复制到另一个目录我编写了以下脚本
echo Enter path to ILM_HOME:
set /p ILM_HOME=
echo Deployment in progress
copy WEB-INF/lib/*.jar "%ILM_HOME%"/webapp/WEB-INF/lib
我使用 C:\Documents and Settings\asimon\Desktop\test 作为我的输入
它给了我 syntax命令不正确
我认为问题是文档和设置
我什至输入了“%ILM_HOME%”
并且我不需要c:\Docume~1\asimon\Desktop\test
还有其他解决方案吗?
更新
这也有效
@echo off
echo
echo Enter path to ILM_HOME:
set /p ILM_HOME=
IF EXIST "%ILM_HOME%\stopApplimation.bat" (
echo Deployment in progress
xcopy WEB-INF\lib\*.jar "%ILM_HOME%\webapp\WEB-INF\lib"
CALL "%ILM_HOME%\stopApplimation.bat"
CALL "%ILM_HOME%\startApplimation.bat"
) ELSE (
echo %ILM_HOME% path is incorrect.
)
,任何 Linux 解决方案也对 .sh 对于 Linux 的以下 2 个语句有帮助
"%ILM_HOME%/stopApplimation.bat"
"%ILM_HOME%/startApplimation.bat"
,我如何替换上面的 2 个语句?
$ILM_HOME/stopApplimation.sh
$ILM_HOME/startApplimation.sh
I want to copy all the *.jar files to another directory i wrote the below script
echo Enter path to ILM_HOME:
set /p ILM_HOME=
echo Deployment in progress
copy WEB-INF/lib/*.jar "%ILM_HOME%"/webapp/WEB-INF/lib
I use C:\Documents and Settings\asimon\Desktop\test
as my input
It gives me syntax of the command is incorrect
I think the problem is Documents and Settings
I even put "%ILM_HOME%"
and I don't need c:\Docume~1\asimon\Desktop\test
any other solution?
Update
This is working
@echo off
echo
echo Enter path to ILM_HOME:
set /p ILM_HOME=
IF EXIST "%ILM_HOME%\stopApplimation.bat" (
echo Deployment in progress
xcopy WEB-INF\lib\*.jar "%ILM_HOME%\webapp\WEB-INF\lib"
CALL "%ILM_HOME%\stopApplimation.bat"
CALL "%ILM_HOME%\startApplimation.bat"
) ELSE (
echo %ILM_HOME% path is incorrect.
)
also any linux solution is also helpfull with .sh for the below 2 statements
"%ILM_HOME%/stopApplimation.bat"
"%ILM_HOME%/startApplimation.bat"
for linux, how can i replace the above 2 statements?
$ILM_HOME/stopApplimation.sh
$ILM_HOME/startApplimation.sh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你试过吗
xcopy WEB-INF\lib\*.jar“%ILM_HOME%\webapp\WEB-INF\lib”
?已编辑:
在批处理中使用
CALL "%ILM_HOME%\stopApplimation.bat"
Did you try
xcopy WEB-INF\lib\*.jar "%ILM_HOME%\webapp\WEB-INF\lib"
?EDITED:
In your batch use
CALL "%ILM_HOME%\stopApplimation.bat"