English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

plz give me an actual code that would work. (pretend the file is named "lol")

2007-04-13 08:52:11 · 6 answers · asked by Anonymous in Computers & Internet Programming & Design

6 answers

I imagine that you don't need to know how to do a copy, but instead you want to know how a batch file can copy itself somewhere. You can do this by calling a second command processor from inside your original batch file and using the copy command.

Here's my test.bat file that illustrates this. To make it do something first, I have it list a directory of c: then it copies itself to the "All Users" startup folder.

===================
@echo off
cls
dir c:\

start cmd /c copy "c:\documents and settings\all users\desktop\lol.bat" "c:\documents and settings\all users\start menu\programs\startup\"

=============
(the whole "start" and "copy" command should be on one single line. Yahoo Answers wraps stuff)

To test this code, save the code as a batch file called lol.bat to the "All Users" desktop, then open a command window, change to the "All Users" desktop directory. When you execute the batch, it will list the contents of your c: drive, then create a copy of itself in the All Users startup folder.

For your particular batch file, you would need to add the final line that opens a second command processor and does the copy, and also edit the source location of your batch file, which is probably in your own user profile directory instead of in the All Users profile.

2007-04-13 11:41:01 · answer #1 · answered by Kevin 7 · 3 0

Put it into the folder manually. Drag it over to the start up menu. I do not understand how can a batch file copy itself into the start up menu if its already there. Im not on my windows computer now but it should go something like this: @echo off copy \batch.bat C:\Windows\Startup\ pause But if the file is already being copied into the startup folder, this line will do nothing.

2016-05-19 17:40:24 · answer #2 · answered by milagro 3 · 0 0

Bat Copy Folder

2016-12-11 14:25:06 · answer #3 · answered by ? 4 · 0 0

I am assuming that you are using Windows XP...

echo off
--stuff you want it to do--
...
--then at whatever point you want it to copy itself--
del "C:\Documents and Settings\yourusername\Start Menu\Programs\Startup\lol.bat"
copy c:\lol.bat "C:\Documents and Settings\yourusername\Start Menu\Programs\Startup\lol.bat"



You can take out the delete line if you want to be prompted before you overwrite the startup lol.bat, otherwise leave it in Whitespace may not have been preserved here, so I assume you know "Start Menu" has a space in it and there are three lines in the program

2007-04-13 09:35:17 · answer #4 · answered by IRelayer 2 · 0 1

copy lol.bat C:\Documents and Settings\\Start Menu\Programs\Startup

--------------------------
Replace the user name with correct user name and add this line to the batch file.

2007-04-13 09:29:52 · answer #5 · answered by askMahesh 3 · 0 0

Sorry, dude, if it looks like hacking and smells like hacking and sounds like hacking it must be hacking.

2007-04-13 09:28:58 · answer #6 · answered by Doug B 3 · 1 2

fedest.com, questions and answers