Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Poll

If a forum project for a game or other utility would YOU help in programing it or in other ways?

Yes - help with Programing
2 (50%)
Yes - help with Other things
0 (0%)
Mabye
1 (25%)
No
1 (25%)

Total Members Voted: 3

Voting closed: January 07, 2015, 01:04:14 PM

Author Topic: Batch Project  (Read 7558 times)

0 Members and 1 Guest are viewing this topic.

shiverbob

    Topic Starter


    Beginner

    Thanked: 1
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows XP
Re: Batch Project
« Reply #15 on: January 21, 2015, 06:40:06 PM »
I know this thing I was working on is not done but i wanted to know if there was anything i could to optimize my code?
Thanks!

[attachment deleted by admin to conserve space]
Pff computers are easy, math is hard.

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: Batch Project
« Reply #16 on: January 22, 2015, 07:22:13 AM »
Start with the basics.
SLEEP is not a valid command on Windows XP, Vista or Windows 7.  Don't know about Windows 8 but I am pretty sure it is not there as Microsoft replaced SLEEP with TIMEOUT starting with Windows Vista.

Windows Vista and above all have the CHOICE command builtin.

shiverbob

    Topic Starter


    Beginner

    Thanked: 1
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows XP
Re: Batch Project
« Reply #17 on: January 22, 2015, 07:49:57 PM »
Oh I download a windows NT resource file and it had sleep in it but Timeout won't work for me?
Pff computers are easy, math is hard.

DaveLembke



    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Batch Project
« Reply #18 on: January 24, 2015, 12:37:56 PM »
Quote
Start with the basics.
SLEEP is not a valid command on Windows XP, Vista or Windows 7.  Don't know about Windows 8 but I am pretty sure it is not there as Microsoft replaced SLEEP with TIMEOUT starting with Windows Vista.

Windows Vista and above all have the CHOICE command builtin.

I actually have been replacing Sleep with Ping in my batches and setting it to x many pings to like Ping 127.0.0.1 -n 30 but so that I dont get an output to display causing the text to scroll, I have been passing the echo to just a file so nothing is displayed during the wait process before moving on such as Ping 127.0.0.1 -n 30 >WaitFile.txt which is overwritten each time a ping is echo'd to it so no fear of the file growing such as if you accidentally used >> appending instead.

For that fact that the batches are run between XP and 7 it was the best solution other than nesting sleep within the root of where the batch is running on each machine using the batch file.

*Note: For the delay to work a NIC has to be active or else it doesnt work so well and you end up passing an error condition to the WaitFile.txt and not getting your delay that you want. For the fact that all my systems are connected to a lan of some sort ether isolated private or to the internet etc it works ok.

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: Batch Project
« Reply #19 on: January 24, 2015, 02:06:58 PM »
Dave, just redirect to nul.

shiverbob

    Topic Starter


    Beginner

    Thanked: 1
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows XP
Re: Batch Project
« Reply #20 on: January 26, 2015, 08:34:54 PM »
Would it be used like this:

ping localhost -n 4
Pff computers are easy, math is hard.

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: Batch Project
« Reply #21 on: January 26, 2015, 08:47:07 PM »
Would it be used like this:

ping localhost -n 4
Did you try it?

Lemonilla



    Apprentice

  • "Too sweet"
  • Thanked: 70
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: Batch Project
« Reply #22 on: January 27, 2015, 08:10:28 AM »
you can shorten it to 'ping ::1 -n 4 >nul' instead of 'ping localhost -n 4 >nul', a whle 6 characters shorter. :)
Quote from: patio
God Bless the DOS Helpers...
Quote
If it compiles, send the files.

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: Batch Project
« Reply #23 on: January 27, 2015, 08:52:08 AM »
you can shorten it to 'ping ::1 -n 4 >nul' instead of 'ping localhost -n 4 >nul', a whle 6 characters shorter. :)
I don't think we can assume they are using a computer with IPv6 installed.

shiverbob

    Topic Starter


    Beginner

    Thanked: 1
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows XP
Re: Batch Project
« Reply #24 on: January 27, 2015, 09:01:31 AM »
The way I used work but what is IPv6?
Pff computers are easy, math is hard.

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: Batch Project
« Reply #25 on: January 27, 2015, 09:21:18 AM »

shiverbob

    Topic Starter


    Beginner

    Thanked: 1
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows XP
Re: Batch Project
« Reply #26 on: January 27, 2015, 05:23:48 PM »
Nice and thanks!
Pff computers are easy, math is hard.

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: Batch Project
« Reply #27 on: January 29, 2015, 08:17:39 AM »
There was a post elsewhere which showed another way:

Code: [Select]
ping -n 4 "">nul

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: Batch Project
« Reply #28 on: January 29, 2015, 10:00:07 AM »
There was a post elsewhere which showed another way:

Code: [Select]
ping -n 4 "">nul
Oh yeah.  I remember that discussion.  I can't remember if it was on CH or Dostips.