Home / Microsoft / Microsoft DOS / command line arguments in dos
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: command line arguments in dos  (Read 462 times)
sri53
Topic Starter
Rookie



Posts: 12


« on: November 06, 2009, 03:38:43 AM »

Hi All,

I am new to dos.
I have to use some command which should accept source and destination path as command line arguments and the file name to copy.
whenever i supply three arguments my functionality should work.
how can i achieve this?

Thanks in advance.
IP logged
sri53
Topic Starter
Rookie



Posts: 12


« Reply #1 on: November 06, 2009, 03:46:32 AM »

can anybody please help me...
IP logged
gpl
Apprentice



Thanked: 25
Posts: 546




« Reply #2 on: November 06, 2009, 03:48:26 AM »

What do you need help with ?
Do you have to create a program to accept and process the parameters, or does this program already exist and you need to know how to supply parameters on the command line ?
IP logged
sri53
Topic Starter
Rookie



Posts: 12


« Reply #3 on: November 06, 2009, 03:55:11 AM »

thank you...
i need a program for this.

IP logged
gpl
Apprentice



Thanked: 25
Posts: 546




« Reply #4 on: November 06, 2009, 04:18:58 AM »

When you say program, you mean batch script ?
IP logged
sri53
Topic Starter
Rookie



Posts: 12


« Reply #5 on: November 06, 2009, 04:22:26 AM »

Actually speaking i do not know how to achieve this...(through batch file or command etc)
Please give me possible ways.
I am sorry as i am new to this forum as well as dos.


IP logged
gpl
Apprentice



Thanked: 25
Posts: 546




« Reply #6 on: November 06, 2009, 04:50:10 AM »

So your requirement is
receive 3 parameters
Source Directory (%1)
Destination Directory (%2)
Filename (%3)

Copy filename from Source to Destination

The simplest way is (with no error checking)
Code: [Select]
Copy %1\%3 %2
IP logged
sri53
Topic Starter
Rookie



Posts: 12


« Reply #7 on: November 06, 2009, 05:05:52 AM »

Thank you gpl.
Its working.
I have created a batch file with your command.
I have passed three arguments to the file while running it.

Can we copy the file from one machine to other machine?
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / command line arguments in dos « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.087 seconds with 21 queries.