473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DOS cd allows '/' in paths once

9
I've run into a peculiar DOS batch scripting issue. I find that I can use a forward-slash in a path when I want to change to a directory on a differnt drive using cd /d only once in a batch script.

For example, imagine my current directory is c:\

If I have a batch script with these commands ( and assuming the drives and directories exist )

cd /d d:/myFolder
c:
cd /d d:/myFolder

the first cd /d will work, the c: gets me back to the c:\, but the second cd /d d:/myFolder will indicate that the path does not exist.

I prefer using forward slash since I'll often create an environment variable ( say Dir=d:/myFolder ) and use that enviroment variable in commands involving Cygwin tools. Cygwin seems to like forward slash better than back slash.

Any ideas?

Thx & rgds

mjg
Aug 3 '06 #1
4 5074
Banfa
9,065 Expert Mod 8TB
On my system, 2k, it changes to the D drive but never enters the folder in qeustion

If it is in an environment variable called MYFOLDER then try this construct

cd /d %MYFOLDER:\=/%

That should change the slashes around for you.
Aug 4 '06 #2
MikeG
9
That is fantastic, but I think you mean

cd ./d %MYFOLDER:/=\%

How sweet. In fact that opens up a whole world of uses for that pattern.

Many thanks!!
Aug 4 '06 #3
Banfa
9,065 Expert Mod 8TB
Well now that depends on if you are trying to convert UNIX slashes to DOS slashes or vis-versa :D

There are a number of other patterns you can use too type

SET /? to see them
Aug 4 '06 #4
MikeG
9
How true.

Reading set /? was more helpful than I thought since it answered a question I had about delayed environment variable expansion.

Thx & rgds

mjg
Aug 4 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

24
by: Lovely Angel | last post by:
Dear Friends Hope you doing great. I have recently shifted to a webhost which is Using Windows 2003 and IIS 6. Now my application was working fine earlier but now I am facing this problem ...
11
by: BoonHead, The Lost Philosopher | last post by:
I think the .NET framework is great! It's nice, clean and logical; in contradiction to the old Microsoft. It only saddens me that the new Microsoft still doesn't under stand there own...
4
by: Julia | last post by:
Hi, I have two application which 'evaluate'( New FileStream(path....) relative path, when evaluating the path inside a window service it always return something like ...
4
by: OutdoorGuy | last post by:
Greetings, I am attempting to compile the code below, but I am receiving an error message when I do so. The error message is: "CSO161: 'Forloop.CalcAvg(int)': Not all code paths return a...
8
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set...
5
by: Shane Thomas | last post by:
Hello, I'm having difficulty handling cookies with paths other than "/". An HttpWebRequest object returns these headers: Date: Tue, 26 Apr 2005 21:29:39 GMT Server: Apache/1.3.33 (Unix)...
3
by: Tom Hartland | last post by:
(Summary: is there a way to convert virtual paths to physical paths using PHP on IIS?) I hope I'm not covering old ground, but I've spent a couple of hours looking for this information and have...
2
by: rjbr | last post by:
ASP.NET problem I have ASP.NET 1.1 application installed on 3 server Win2003/IIS6 Relative paths are being resolved in 2 of those but not on one dir structire /app/ /import
5
by: costantinos | last post by:
Hello. I have implemented the Dijkstra shortest path algorithm, it works fine but I have one question on how I can improve something. I want to find all the possible shortest paths from a node...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.