使用路径中的空格使用批处理脚本复制文件

发布于 2024-12-10 16:36:13 字数 1064 浏览 0 评论 0原文

我想将所有 *.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

メ斷腸人バ 2024-12-17 16:36:13

你试过吗
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"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文