Computing.Net > Forums > Programming > Need help on Batch file for Shutdow

Need help on Batch file for Shutdow

Reply to Message Icon

Original Message
Name: jellzang
Date: April 23, 2008 at 20:23:09 Pacific
Subject: Need help on Batch file for Shutdow
OS: Windows XP
CPU/Ram: idunno
Model/Manufacturer: idunnoo
Comment:

Hello
I'm new to this forum
And I'm a noob at programming (I don't even know the "C" of "C++" :))
I was messing with Batch file few monthes ago
and I found a way to use shutdown commands
I goto a school with a somewhat secured network :)

This is my code:

@echo on
cls
i -s -m \\computer-10 -t 00 -f

"computer-10" is the computer I want to shutdown remotely and the computer is in the same room as me (I can't access computers in the other rooms cuz I get the "Access denied" message)

Anyways
I want to loop this batchfile using "GOTO" command, like this:

@echo on
1:
cls
i -s -m \\computer-10 -t 00 -f
goto 1

It worked well. So, I moved on to trying to shutdown EVERYONE's computer in the room.
My friend told me about the %VAR% command so I tried this:

@echo on
set var=10
1:
cls
i -s -m \\computer-%var% -t 00 -f
goto 1

however, I wanted to use a math arithmetic, like %var%+1, but ofcourse, It doesn't work, cuz it's not written properly
I was wondering if you guys knew how to increse the VARIABLE value by 1 everytime I repeat the batch file

or If you have any other commands that would do that, plz help me:)
Thanks for your time

ag2s


Report Offensive Message For Removal


Response Number 1
Name: klint
Date: April 24, 2008 at 02:55:32 Pacific
Reply: (edit)

Are you trying to get yourself expelled or something?

When you shut down someone else's machine, it's all logged and traceable.


Report Offensive Follow Up For Removal

Response Number 2
Name: jellzang
Date: April 24, 2008 at 16:45:52 Pacific
Reply: (edit)

Where is it logged?

ag2s


Report Offensive Follow Up For Removal

Response Number 3
Name: klint
Date: April 25, 2008 at 02:10:11 Pacific
Reply: (edit)

At the headmaster's office!

No just kidding, it depends on how the system administrators have configured everything but typically in an event log on the computers you've just shut down.


Report Offensive Follow Up For Removal

Response Number 4
Name: TanelTM
Date: April 30, 2008 at 07:07:57 Pacific
Reply: (edit)

@echo off
set var=1
set endvar=10
:loop
cls
echo %var% :: Just to display the current var.
i -s -m \\computer-%var% -t 00 -f
if "%var%"=="%endvar%" (
goto end
) else (
set /a var=%var%+1
goto loop
)
:end

this way it will loop until %var% is equal to %endvar% and if they are not equal it will add 1 to %var%


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Need help on Batch file for Shutdow

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge