Batch File Programming Help Needed

  • nova
  • Newbie
  • Newbie
  • nova
  • Posts: 11

Post 3+ Months Ago

Hi guys this is my first post in these forums :D

I have just begun to write simple batch files this week,mostly just for fun.

Im looking for the code/command that will make a batch file copy its-self to the dir c:/Folder once its open.

....................................................................................................................
So no matter where the file is when its opened it will copy its self to c:/Folder
....................................................................................................................
Dose anyone know how this can be done ???

Remember im new to this so please either explain really well or keep the code easy if u can.
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

Code: [ Select ]
@echo off
IF EXIST %0 (copy %0 c:\folder\) ELSE (copy %0.bat c:\folder\)
  1. @echo off
  2. IF EXIST %0 (copy %0 c:\folder\) ELSE (copy %0.bat c:\folder\)
  • nova
  • Newbie
  • Newbie
  • nova
  • Posts: 11

Post 3+ Months Ago

Ur a genious that worked perfectly

Tnx :D
  • nova
  • Newbie
  • Newbie
  • nova
  • Posts: 11

Post 3+ Months Ago

Hi again im am in need of ur guidance once more

I have made a batch file which runs some simple tasks on my win xp box.
But when i launch the .bat file it runs in a command window and if someone presses x then the batch file stops working.

Is there a way of making the batch file run invisibly without the command window so that nobody can kill it before its finished ?
...................................................................................................................
I also realise that if someone presses-control-alt and delete they will get task manager and would be able to kill the process there.

So i have made a loop

:BEGIN
taskkill /f /im taskmgr.exe
GOTO BEGIN

This is messy and interfers with the rest of the code,because its constantly killing a process even if its not active.

So my second question would be how can I make it so as when the process taskmgr.exe is active then and only then it is killed.

Im still new to batch programming can anyone help ???
  • _nYght
  • Novice
  • Novice
  • _nYght
  • Posts: 17

Post 3+ Months Ago

why don't you try with windows scripting host, because batch programming always need a console window to process the batch files, remember that it was designed to solve the MS- DOS tasks
  • nova
  • Newbie
  • Newbie
  • nova
  • Posts: 11

Post 3+ Months Ago

Sadly I cant use the wscript command because in order to do that Id need 2batch files,1 which opens the other with wscript.

Im trying to keep this as simple as possible,I have made my batch program so as in 1 click it dose everything i need it to do,with out any user input and the only problem i have with it is that it can be cancled simply by pressing the x on the cmd windows.Which is really not good because it defys the purpose of my program.

Dose anyone know of a way that I can make it so that the cmd window cannot be closed ???

All ideas and sugestions welcome
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23460
  • Loc: Woodbridge VA

Post 3+ Months Ago

What's the purpose of the batch file?

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 68 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.