开发者

using space in path for copying files using batch script

开发者 https://www.devze.com 2023-04-13 06:07 出处:网络
I want to copy all the *.jar files to another directoryi wrote the below script echo Enter path to ILM_HOME:

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_HO开发者_运维技巧ME: 
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


Did you try
xcopy WEB-INF\lib\*.jar "%ILM_HOME%\webapp\WEB-INF\lib"?

EDITED:
In your batch use CALL "%ILM_HOME%\stopApplimation.bat"

0

精彩评论

暂无评论...
验证码 换一张
取 消