Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Batch File + Questions


  • Please log in to reply
7 replies to this topic

#1 Slim Nelson

Slim Nelson

  • Members
  • 223 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:08:15 PM

Posted 17 June 2013 - 12:26 AM

I am currently trying to make a batch file that kills all unneeded processes, then loads just this single full screen program, so all or most of the memory's attention is pointed towards this program because it's all I will be using when this program is active.

 

I googled around a bit because I am not extremely familiar with microsoft commands, but I will be using this command for each process I need to kill:

 

 

taskkill /f /im "Program.exe"

 

 

And this command for the single program I need to run:

 

 

"C:\Program Files\XBMC\XBMC.exe"

 

 

And then when I close my single program (XBMC.exe) I am going to need the batch file to automatically start up all the processes/tasks I ended/killed, so I'm back to exactly where I was before. So correct me if I'm wrong, my batch file should look something like this for example:

 

 

taskkill /f /im "PROCESS_1.exe"

taskkill /f /im "PROCESS_2.exe"

taskkill /f /im "PROCESS_3.exe"

taskkill /f /im "PROCESS_4.exe"

taskkill /f /im "PROCESS_5.exe"
"C:\Program Files\XBMC\XBMC.exe"
/wait

"C:\Windows\System32\PROCESS_1.exe"

"C:\Windows\System32\PROCESS_2.exe"

"C:\Windows\System32\PROCESS_3.exe"

"C:\Windows\System32\PROCESS_4.exe"

"C:\Windows\System32\PROCESS_5.exe"

NET SEND %ComputerName%

 

 

I put the net send at the end just to show a popup so I would know when the batch file has completed, if you know of a better "batch file finished notification", please let me know :P

 

 

 

Also, I am not completely sure on which processes I can absolutely kill and load back up whenever I please, So if anyone is willing to go the extra mile for me and yes or no all my processes, that would be extremely appreciated. I am mostly aware on the program processes I, myself downloaded like Firefox, xWidget, Startkiller, etc. But here is my complete list if I just went into Task Manager right now:

 

 

firefox.exe (Firefox)
explorer.exe (Windows Explorer
dwm.exe (Desktop Windows Manager)

flashplayerplugin_11_7_700_224.exe (Adobe Flash Player 11.7 r700)

plugin-container.exe (Plugin Container for Firefox)

NDSTray.exe (ConfigFree TM Task tray menu)

MSASCui.exe (Windows Defender User Interface)
flashplayerplugin_11_7_700_224.exe (Any explaination as to why I have 2 of the same processes always running?)

xwidget.exe (Widget Engine by xwidget.com)
taskeng.exe (Task Scheduler Engine)

SynTPEnh.exe (Synaptics Touchpad Enhancements)

egui.exe (ESET GUI)

RtHDVCpl.exe (HD Audio Control Panel)

igfxsrvc.exe (igfxsrvc Module)
mbamgui.exe (Malwarebytes Anti-Malware)
csrss.exe
winlogon.exe
CFSwMgr.exe (ConfigFree Switch Manager)
hkcmd.exe (hkcmd Module)
IAAnotif.exe (Event Monitor User Notification Tool)
TPwrMain.exe (TOSHIBA Power Saver)
taskeng.exe (Any explaination as to why I have 2 of the same processes also always running?)

igfxpers.exe (persistence Module)
igfxtray.exe (igfx Tray Module)
SynTPHelper.exe (Synaptics Pointing Device Helper)
StartKiller.exe (StartKiller Application)
SmoothView.exe (SmoothView)
TOSCDSPD.exe (CD/DVD Drive Acoustic Silencer)
 

 

 

And lastly, another question I have to ask, is do I really need things like TOSHIBA Power Saver, Synaptics Touchpad (I use mouse most of the time) Flash Player Plugin, Windows Defender User Interface (Is it just the visual part of the program?), etc, running 24/7? If you could have elaborate information on some processes that are necessary, that would be great and I sincerely appreciate anyone who has some answers to offer, thanks again guys.


Edited by Slim Nelson, 17 June 2013 - 10:55 AM.

Hulk_Tag.png


BC AdBot (Login to Remove)

 


#2 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:06:15 PM

Posted 17 June 2013 - 09:49 AM

It sounds like Powershell would be more your friend than batch script for this particular application, as batch script doesn't come with utilities to list processes, or perform even basic string manipulations.

Don't try to kill all processes though -- several processes are important for the stability of the system and killing them will result in a BSOD. (e.g. the Local Security Authority Sub System process)

That said, buying more memory will almost certainly be cheaper than attempting to write a tool to do this :)

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#3 Slim Nelson

Slim Nelson
  • Topic Starter

  • Members
  • 223 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:08:15 PM

Posted 17 June 2013 - 01:15 PM

This won't work with a batch file?

 

Don't try to kill all processes though -- several processes are important for the stability of the system and killing them will result in a BSOD.

 

Yes, I am aware of this, I want to kill all I can without that happening, that's why I wrote this below... :thumbdown:

 

Also, I am not completely sure on which processes I can absolutely kill and load back up whenever I please, So if anyone is willing to go the extra mile for me and yes or no all my processes, that would be extremely appreciated. I am mostly aware on the program processes I, myself downloaded like Firefox, xWidget, Startkiller, etc. But here is my complete list if I just went into Task Manager right now:

If no one wants to do that, it'd be cool if someone can instead just simply find me a webpage listing all killable Windows processes before malfunction or something like that, that would be very helpful in completing my batch file. I have tried looking for something like that on my own but I am not familiar enough with all the Windows processes to verify if this website is telling me which ones are supposably safe to kill.

 

That said, buying more memory will almost certainly be cheaper than attempting to write a tool to do this :)

 

How will spending money be cheaper than putting a little work into a small batch file? :scratchhead:


Hulk_Tag.png


#4 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:06:15 PM

Posted 17 June 2013 - 01:26 PM

This won't work with a batch file?

I'm not sure how you are going to enumerate processes, filter out the ones that need to be filtered out, and then pass the result as arguments to multiple invocations of taskkill, no. I'm not saying it is impossible, but I'm saying that it'll be far easier to do in Powershell, which supports this kind of scenario out of the box.

How will spending money be cheaper than putting a little work into a small batch file?

Your time is worth something. This isn't an easy thing to do in a batch file.

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#5 Slim Nelson

Slim Nelson
  • Topic Starter

  • Members
  • 223 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:08:15 PM

Posted 17 June 2013 - 03:48 PM

 

This won't work with a batch file?

 

I'm not sure how you are going to enumerate processes, filter out the ones that need to be filtered out, and then pass the result as arguments to multiple invocations of taskkill, no. I'm not saying it is impossible, but I'm saying that it'll be far easier to do in Powershell, which supports this kind of scenario out of the box.

 

Alright, I hear ya, thank you for your input. I will look into Powershell and see what I can do.

EDIT: Does anyone else have anything to add?


Edited by Slim Nelson, 17 June 2013 - 03:54 PM.

Hulk_Tag.png


#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:07:15 PM

Posted 17 June 2013 - 08:50 PM

Powershell.

#7 Slim Nelson

Slim Nelson
  • Topic Starter

  • Members
  • 223 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:08:15 PM

Posted 17 June 2013 - 09:34 PM

Alright, thank you guys.

I've searched around about Powershell and made a few changes to my script for powershell. Although, I have ran into one problem as to where the script won't wait until I close my XBMC program to load the processes back up.. Here is my script:

 

taskkill /f /im "explorer.exe"

taskkill /f /im "StartKiller.exe"

taskkill /f /im "xwidget.exe"

start "C:\Program Files\XBMC\XBMC.exe" | out-null

start "C:\Program Files\XWidget\XWidgetStarter.exe"

start "C:\Windows\explorer.exe"

start "C:\Program Files\StartKiller\StartKiller.exe"

How come XBMC.exe won't wait until it is closed to run the next three programs? It says online to use "| out-null".
 

 

 

 

 

EDIT: I figured it out.
 

 

taskkill /f /im "explorer.exe"

taskkill /f /im "StartKiller.exe"

taskkill /f /im "xwidget.exe"

start "C:\Program Files\XBMC\XBMC.exe"

Wait-Process XBMC

start "C:\Program Files\XWidget\XWidgetStarter.exe"

start "C:\Windows\explorer.exe"

start "C:\Program Files\StartKiller\StartKiller.exe"

 

 

Thank you Billy for all of your help, apologies for my skepticism at first. But you were completely right, I tried doing my idea and scripted it through a batch file at first and it wouldn't load all the programs back up every time I tried, only one or two. As soon as I researched a little about Powershell, editted my script as necessary, ran the powershell script through a batch file shortcut and everything has worked just as I've wanted it to, thank you again for your help.


Edited by Slim Nelson, 17 June 2013 - 10:21 PM.

Hulk_Tag.png


#8 Slim Nelson

Slim Nelson
  • Topic Starter

  • Members
  • 223 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:08:15 PM

Posted 18 June 2013 - 03:16 PM

One last thing if you don't mind.

 

After I'm done using XBMC and close it, it loads everything back up as it should, but certain tray icons are not appearing like my antivirus and malwarebytes, it says they are running though when I look through task manager.

 

Am I missing something in my script or is it because of the termination of explorer.exe? Is there a way to have them loaded back in the tray?

EDIT: I think I need a way to kill explorer.exe cleanly and not forcefully but whenever I try it without force, it will just restart itself..?


Edited by Slim Nelson, 18 June 2013 - 04:28 PM.

Hulk_Tag.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users