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

How To Create A Batch File With 2 Commands


  • Please log in to reply
10 replies to this topic

#1 medab1

medab1

  • Members
  • 844 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:earth
  • Local time:04:43 PM

Posted 31 January 2006 - 08:20 AM

I want to make a batch file to run sfc /scannow & then restart the computer.
I use XP Home SP2.

I made one with sfc /scannow & shutdown -r but it restarts after sfc /scannow is just starting to run.

I need sfc /scannow to finish & then for the restart command to kick in.
The purpose is to let sfc /scannow to run & the computer to restart & run Error Checking & a boot time Avast scan.

I can set up the Avast & Error checking seperate from the .bat file.
They will run when the computer restarts.
Any help will be appreciated.
Thank you.

Learn to take screenshots & add them to your posts. :thumbup2:

https://www.bleepingcomputer.com/forums/t/43088/how-to-capture-and-edit-a-screen-shot/#entry4532851

Learn to use Google Search.  :busy:

Make full system images to restore to if your computer goes bonkers.


BC AdBot (Login to Remove)

 


#2 ThorXP

ThorXP

  • Banned
  • 880 posts
  • OFFLINE
  •  
  • Local time:04:43 PM

Posted 01 February 2006 - 04:40 PM

Here is a web site - Making Batch Files

http://www.tnd.com/camosun/elex130/dosbatchtutor1.html

HSould help with your problem.

cya l8r

ThorXP

#3 medab1

medab1
  • Topic Starter

  • Members
  • 844 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:earth
  • Local time:04:43 PM

Posted 02 February 2006 - 08:34 AM

Here is a web site - Making Batch Files

http://www.tnd.com/camosun/elex130/dosbatchtutor1.html

HSould help with your problem.

cya l8r

ThorXP



Thank you.
I'm working on it.
This seems to be a difficult batch file to make because the sfc /scannow works in the background & the shutdown command won't "wait".
Maybe I should make 2 batch files & have one call up the next after the first is finished?

Learn to take screenshots & add them to your posts. :thumbup2:

https://www.bleepingcomputer.com/forums/t/43088/how-to-capture-and-edit-a-screen-shot/#entry4532851

Learn to use Google Search.  :busy:

Make full system images to restore to if your computer goes bonkers.


#4 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad


  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:04:43 PM

Posted 02 February 2006 - 11:04 AM

Yep, that's the ticket!

Is there really a need to run SFC.EXE like this? This makes me wonder if there's something going on that shouldn't be!
My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.

#5 medab1

medab1
  • Topic Starter

  • Members
  • 844 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:earth
  • Local time:04:43 PM

Posted 02 February 2006 - 04:39 PM

Yep, that's the ticket!

Is there really a need to run SFC.EXE like this? This makes me wonder if there's something going on that shouldn't be!



Like what shouldn't be going on?

I want sfc /scannow to run.
The computer to restart & run Error-checking & a boot time scan by Avast.
Both of which I can set up to run seperate from the batch file.
I just want all these things to run while I am asleep or while I am at work.
Besides,it is an interesting thing to accomplish.
If there is a way to get it to work.
I like to learn new things.

Learn to take screenshots & add them to your posts. :thumbup2:

https://www.bleepingcomputer.com/forums/t/43088/how-to-capture-and-edit-a-screen-shot/#entry4532851

Learn to use Google Search.  :busy:

Make full system images to restore to if your computer goes bonkers.


#6 medab1

medab1
  • Topic Starter

  • Members
  • 844 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:earth
  • Local time:04:43 PM

Posted 03 February 2006 - 07:54 PM

The answer was simple.

sfc /scanonce

Open RUN.
Type in sfc /scanonce & OK.
Set up Error-checking & boot time virus scan.
Restart Computer.
Go to sleep or work.
System File Checker automatically runs after Error-checking & a boot time virus scan & Windows restarts.

No batch files needed. :thumbsup:

Learn to take screenshots & add them to your posts. :thumbup2:

https://www.bleepingcomputer.com/forums/t/43088/how-to-capture-and-edit-a-screen-shot/#entry4532851

Learn to use Google Search.  :busy:

Make full system images to restore to if your computer goes bonkers.


#7 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad


  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:04:43 PM

Posted 03 February 2006 - 10:21 PM

The reason that I asked about SFC.EXE was because it replaces critical, protected operating system files.

The more times that you run it, the more chance there will be for something to screw it up - and you don't want that happening with critical, protected operating system files.

The tool was designed to fix problems - not for use as a routine maintenance tool.

Chances are that nothing will go wrong - but if there is a problem it will cripple your system.
My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.

#8 medab1

medab1
  • Topic Starter

  • Members
  • 844 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:earth
  • Local time:04:43 PM

Posted 04 February 2006 - 07:21 AM

I have a recovery CD if something really goes wrong.
In general,my computer runs good with no problems.
I just wanted a way to run these 3 things one after the other because,if there is a glitch,and it happens at a bad time where I HAVE to leave the computer, I can run them all & leave & check on it when I get back.

Learn to take screenshots & add them to your posts. :thumbup2:

https://www.bleepingcomputer.com/forums/t/43088/how-to-capture-and-edit-a-screen-shot/#entry4532851

Learn to use Google Search.  :busy:

Make full system images to restore to if your computer goes bonkers.


#9 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad


  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:04:43 PM

Posted 07 February 2006 - 08:10 AM

If you run SFC.EXE you'll have to figure out the command line switch to run it unattended.

So, then, if you run it unattended - you'll have to leave your installation CD in the drive (if it needs to replace a file). If the CD isn't there, the program will hang.

Now, if the program finishes, what are you going do about visiting Windows Update? What if the missing file that was replace by SFC.EXE was a critical one that exposes a vulnerability on your system? Your system will sit there vulnerable until you get back to it.

In short, it's probably not a good idea to do this. It can create more problems than it would cure.
My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.

#10 medab1

medab1
  • Topic Starter

  • Members
  • 844 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:earth
  • Local time:04:43 PM

Posted 07 February 2006 - 06:18 PM

I don't need the recovery CD.
All needed files are already stored in the I386 folder & on my D drive.

Never had a problem with Microsoft Update.
I visit regularly even though I have automatic updates enabled.
I pretty much know what I'm doing.
My computer runs fine with no adware or spyware or viruses.
You'll notice I do not post here with computer problems.
This thread was just a process I wanted to set up.
Which I solved on my own & it does work as I want it to work.
With no problems resulting from it.
I have tested it numerous times & everything is OK.
*******************************************

If you run SFC.EXE you'll have to figure out the command line switch to run it unattended.

So, then, if you run it unattended - you'll have to leave your installation CD in the drive (if it needs to replace a file). If the CD isn't there, the program will hang.

Now, if the program finishes, what are you going do about visiting Windows Update? What if the missing file that was replace by SFC.EXE was a critical one that exposes a vulnerability on your system? Your system will sit there vulnerable until you get back to it.

In short, it's probably not a good idea to do this. It can create more problems than it would cure.


Learn to take screenshots & add them to your posts. :thumbup2:

https://www.bleepingcomputer.com/forums/t/43088/how-to-capture-and-edit-a-screen-shot/#entry4532851

Learn to use Google Search.  :busy:

Make full system images to restore to if your computer goes bonkers.


#11 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad


  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:04:43 PM

Posted 09 February 2006 - 10:50 AM

OK, I'll shut up! :thumbsup:
My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users