copying file in location
Moderator: DosItHelp
copying file in location
hi i want my batch file when is runing will copy his self in a place
how can i do this?
like a virus
how can i do this?
like a virus
Re: copying file in location
%0 references the batch file name.
Re: copying file in location
can you exmplain more?
i know i have to use that but i cant find any good help about it
tnx by the way
i know i have to use that but i cant find any good help about it
tnx by the way
Re: copying file in location
tcpman wrote:hi i want my batch file when is runing will copy his self in a place
how can i do this?
like a virus
It's a bit worrying when someone says 'virus' when referring to some code.
If there is a legitimate reason and you explain further then it will help us to know what to suggest.
Re: copying file in location
tcpman wrote:can you exmplain more?
i know i have to use that but i cant find any good help about it
tnx by the way
So you don't know how to use the COPY command?
Re: copying file in location
well i can create a virus in c++ if i want ! why i should use a batch?
i know how copy works but i dont know how to %0 will work
i know how copy works but i dont know how to %0 will work
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: copying file in location
%0 is a variable that contains the path and name of the script that is currently running, so will make a copy of the script in the folder you were in when you ran the script.
Code: Select all
copy %0 .
Re: copying file in location
tnx i thought it will need more then just typing %0
Re: copying file in location
tcpman wrote:well i can create a virus in c++ if i want ! why i should use a batch?
Why should anyone help you to do so in batch??
The real point is that you ask for free help and don't even want to tell anyone what you are doing - You just make cryptic comments about a virus.
Thread locked.
Re: copying file in location
tcpman wrote:tnx i thought it will need more then just typing %0
How hard would it have been for you to create a simple batch file with nothing more than
Code: Select all
@echo off
echo %0
Then from there you would have realised what the variable is and then could have tested it with the copy command.
As they say "You can lead a horse to water....."
or
"Teach a man to fish versus giving them the fish"