How to change a directory on windows via perl script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to change a directory on windows via perl script
# 1  
Old 12-10-2008
How to change a directory on windows via perl script

How to change a directory on windows via perl script.

I wanna mount a share on windows via perl script.

I have used:-

system("dir");

gives the list of directories in the drive i am.This command works well.

Now i want to move from c drive to z drive via perl script.I am using:-

system("chdir /D z:");

also tried---
system("z:");
`z:`


but no success...

can some one help me please?????
# 2  
Old 12-10-2008
What happens if you use Perl's built-in chdir function?
See https://www.unix.com/shell-programmin...ries-perl.html

Last edited by spirtle; 12-10-2008 at 05:20 AM..
# 3  
Old 12-10-2008
I got the soln friends...

I did it friends....


chdir('C:\test_directory');
system('md newdirectory');
system('dir');

it worked...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL: testing directory on windows platform

Hi Gurus, kindly analyse the following for me, please OS: Windows 7 Code location: C:\ Output: "Program Files not being recognised" "System Volume Information is a directory" "Windows not being recognised" main { my @dirlist = <*>; foreach my $fn... (0 Replies)
Discussion started by: biglau
0 Replies

2. Shell Programming and Scripting

Change Directory in Perl

Hi Can any one please support: From Windows, I am running perl script located in C:/scripts directory and need to run a command "ls | sort | uniq" on the files in D:/temp directory. #!c:\perl\bin\perl.exe $file_dir="D:\\temp"; $command1="cd"; $command2="ls | sort | uniq";... (2 Replies)
Discussion started by: sureshcisco
2 Replies

3. Shell Programming and Scripting

How to change a directory in shell script?

HI, I need to change the working directory by using the shell script /Export/home/user_name I have to go one step back like /Export/home Please help on this.:confused: (3 Replies)
Discussion started by: thelakbe
3 Replies

4. UNIX for Dummies Questions & Answers

Need help configuring Active Perl on Windows Vista.: Perl Scripting on Windows

Hi All, Need help configuring Active Perl on Windows Vista. I am trying to install Active Perl on Windows Vista. The version of Active Perl i am trying to install is : ActivePerl 5.10.1 Build 1006 After installing it through cmd, When i try to run perl -v to check the version, i get the... (2 Replies)
Discussion started by: Vabiosis
2 Replies

5. Shell Programming and Scripting

directory change in shell script

Hi, I am trying to change the directory in my script, & want to check if the directory is present or not . Ex: cd /home/xyz/temp/logs if the logs directory is not present i want to show the error in script instead of shell script error. Can anybody please help me on the same Thx in... (2 Replies)
Discussion started by: vls1210
2 Replies

6. Shell Programming and Scripting

Change the Windows Batch script to UNIX shell script.

Hi, When I run the below script in UNIX it's throwing syntax errors. Actually it's a windows batch script. Could anyone change the below Windows Batch script to UNIX shell script... Script: REM :: File Name : Refresh_OTL.bat REM :: Parameters : %1 - Region REM :: : %2 - Cube Type REM ::... (5 Replies)
Discussion started by: tomailraj
5 Replies

7. Linux

Change directory in a shell script

How do u change ur directory using a shell script?? (12 Replies)
Discussion started by: laxmi
12 Replies

8. Shell Programming and Scripting

Change of directory thru script

:confused: Hi All, This script is not working. I want to change the directory as per users selection in current shell. Looks like it is spawning sub-shell internally. I have used . changedir.sh source changedir.sh ./changedire.sh But did not work. Currently shell directory remain the... (4 Replies)
Discussion started by: shiningram
4 Replies

9. Shell Programming and Scripting

Change Directory via a script?

I would like to have a script that would change my current working directory. However, any time I execute a 'cd' command in a script, it holds only for the life of that script -- the working directory on exit is the same as when the script was initiated. Is it possible to have the script return... (3 Replies)
Discussion started by: George Borrmann
3 Replies

10. Shell Programming and Scripting

how to change "set" values in perl, windows...

i am using perl in win2000advanced server... --------------------------- perl -version: --------------------------- This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 638 provided by... (1 Reply)
Discussion started by: sekar sundaram
1 Replies
Login or Register to Ask a Question