开发者

Problem while using cd command in cygwin based windows batch script

开发者 https://www.devze.com 2023-02-09 14:14 出处:网络
I am facing a problem in windows batch script. I have installed cygwin inmy system. So i am u开发者_如何学Gosing bash commands inside my batch script for efficiency. Consider the below command

I am facing a problem in windows batch script. I have installed cygwin in my system. So i am u开发者_如何学Gosing bash commands inside my batch script for efficiency. Consider the below command

cp -rf D:/Ashok E:/Data
E:
cd E:/Data
cd E:/Data

Output is

c:>sample.bat
c:>cp -rf D:/Ashok E:/Data
c:>E:
E:>cd E:/Data
E:/Data>cd E:/Data
The system cannot find the specified path

While in the same folder (E:/data), i am trying to do the cd, that time i am getting error message. Because it treated that entire "E:/Data" as a folder name. How to get rid of this problem. What we can do to solve this problem.


Have you tried using the cygdrive prefix?

cd /cygdrive/e/Data


Using the proper back slash in the cd command will solve the problem. But cp command is supporting both the slashes.

c:>sample.bat
c:>cp -rf D:/Ashok E:/Data
c:>E:
E:>cd E:\Data
E:/Data>cd E:\Data
0

精彩评论

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

关注公众号