how I change dir in dos


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how I change dir in dos
# 1  
Old 03-18-2008
how I change dir in dos

Hi

I have a dos batch file in window server where I call a cmd command for creating some db.
this cmd commad is located in e:\data\abcd\xyz.cmd.

Now I call this batch file from unix ssh.sh but my access point is D in window server here I want to change the dos prompt to e:\data\abcd.
in xyz.bat.

here is my batch file

regards

JAmil

SETLOCAL


set DateStr=%~2&if "%~2"=="" set DateStr=%date%
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('"echo.|date"') do (
for /f "tokens=1-3 delims=/.- " %%A in ("%DateStr:* =%") do (
set %%a=%%A&set %%b=%%B&set %%c=%%C))
rem set /a "yy=10000%yy% %%10000,mm=100%mm% %% 100,dd=100%dd% %% 100"


set filename=%yy%%mm% %dd%
echo.%filename%

Cd E:
cd \data
cd E:\data\local-ch-da

E:\data\local-ch-da\start_local-CH-DA_cablecom.cmd %yy%%mm% %dd%



endlocal
# 2  
Old 03-18-2008
DOS does not think of C: D: etc as directories. They are "drives". To change drives you just do:
D:
So a pair of commands like:
D:
cd \data
might be needed.
# 3  
Old 03-18-2008
you mean
i write just e: in dos bat file it change the directory.

from doller prompt i call a bat file
ssh user@connection e:\data\abc.bat
and in this batch I want to change the directory to e: because i get d: as default prompt.

abc.bat like this
e:
cd \data
start_xzy.cmd
# 4  
Old 03-18-2008
Again, e: is a drive. e: is not a directory. To change your drive to e you need a line in your bat file that looks exactly like this:
e:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Change Dir doubt and some advice.

Hello, This is my first post in this forum. I need to change the owner of several directories and files in Solaris 10 Operating system, more than 500. The server is in production and my question is: If i change the owner of directories and files, the server can become unstable, i mean,... (2 Replies)
Discussion started by: checoturco
2 Replies

2. Windows & DOS: Issues & Discussions

DOS Dir - listing of full path and timestamp

Hi, (Apologies, I'm sure I'm not the first person to raise this question but so far in my searches haven't found a good answer). I would like to output a listing per line of filename (including full path) and 'last updated' timestamp. e.g: Z:\dir1\file1.txt 01/02/2010 10:43... (5 Replies)
Discussion started by: GM_AIX
5 Replies

3. Shell Programming and Scripting

Generate a change list of files/dir

Is there a tool that can diff a directory and generate a change list of files in that directory based on a previous snapshot on the directory? For example /etc/a.txt:changed /etc/b.txt:removed /etc/c.txt:added Thanks! (1 Reply)
Discussion started by: overmindxp
1 Replies

4. HP-UX

could not able change permission of /home dir

Hi i am new to this admin area . i have created user with name as "ab" and gave home dir as /home/ab . when i tried to create the /home/ab dir , i got he following error. "mkdir: Failed to make directory "/home/ab"; Operation not applicable " Thanks in advance . (1 Reply)
Discussion started by: expert
1 Replies

5. Solaris

How to change permission for opt dir in Solaris Zones?

Hi All While configuring zone I run add inherit-pkg-dir I thing this command will inherit opt,etc,lib... directories from global zone to non global zone with read permission................ So this makes problem for me I want to edit one file opt dir which is useful for my project but when I... (4 Replies)
Discussion started by: vijaysachin
4 Replies

6. Solaris

Change inherit-pkg-dir to writable

/lib in my sparse zone is running and its inherit-pkg-dir due ti which its readonly is it possible to make it writable if yes how ? (2 Replies)
Discussion started by: fugitive
2 Replies

7. Solaris

cant able to change permission in a DIR as root user

Hi my directory not accepting any commands. its simply telling permission denied. i tried ( cp, mv, rm ) as roor i want to set default permissons to this DIR please find the Logs below. dr-xr-xr-x 1 root root 1 Jun 1 09:04 AP1_ROP ( original dir) root> chmod 777... (5 Replies)
Discussion started by: vijayq8
5 Replies

8. Windows & DOS: Issues & Discussions

DOS script to grab the first file in a dir and rename it

:confused: Hello, Is there any way to use the dir command / some DOS Script to select only first file of similar pattern of files in a direcotory and rename it for example, one directory has 5 files abc_1005.txt abc_5256.txt abc_2001.txt abc_2003.txt abc_3006.txt by use script I would... (2 Replies)
Discussion started by: raghav525
2 Replies

9. Shell Programming and Scripting

from dos dir a: to similar to a dds tape?

is it possible to see what is in a dds tape? like in dos, we can write dir a: to see the contents of it? thanks PS : actually, i came from a DOS background. so most of the time, i will try to relate unix to dos. of course, dos never came close to unix. but unix is like many instances of dos... (3 Replies)
Discussion started by: yls177
3 Replies

10. UNIX for Dummies Questions & Answers

change login dir

Ok when I log in to my terminal I land in a dir. How can I change the dir that I start from when I login? Thanks for the help, sure it is a no brainer for you guys cd (5 Replies)
Discussion started by: lorcet222
5 Replies
Login or Register to Ask a Question