« first day (2355 days earlier)      last day (2662 days later) » 

6:00 PM
@BenN I never used PowerShell before
 
Eventually you might want to, it's pretty neat
But back to batch, what exactly should the non-working code be doing?
 
@MathCubes So add the new stuff line by line and figure out when it stops working. And remove the echo off so you can see what the batch file is actually doings. Test after each step.
 
@DavidPostill Done did
 
Where exactly does the undesired behavior come in?
 
@BenN It does the "echo !Timer_Secondary_Repeat_Counter_Value! repeats remain" which is at the end of the lane basically first. So it displays 5 than 4. So it appers like "54"
 
Dog
6:02 PM
DavidPostill is made from frozen unicorn tears?
2
Interesting. This I did not know.
Explains a lot.
 
Are you missing a closing parenthesis on your for loop?
 
I have given you the code. You can easily run it if you are on Dos or Windows.
Again if I used & with it than it wouldn't run for some reason
 
So the non-& version works as intended?
And does what you're trying to accomplish?
I'm still a little fuzzy on what the desired output is, could you please show what's supposed to happen?
 
I am trying to fit it on one line so that I can feed it though another cmd without needing another batch file
So how it should works is
Timer_Secondary_Repeat_Counter_Value which is the variable for how many times the loop has run -1 for each time. Having that echo at the end of the "line" but it echo when the loop first runs.
 
Dog
Have you tried Powershell?
2
 
6:08 PM
No. I have only play around with the IDE before
With Power shell can I make a user input?
 
With PowerShell you can do anything
5
 
Really? Even make a simple game with the arrow keys? I assume not but?
 
It would be really difficult, but technically doable
 
Really
 
Also, when I run your batch file with multiple lines, it doesn't appear to do anything
 
6:11 PM
This one?
@echo off
setlocal enabledelayedexpansion
set Timer_Primary_Repeat_Counter_Value=5
set Timer_Primary_Second_Counter_Value=2
set User_Primary_Command="echo Hello world!&echo(&pause"

::repeat =1 and timer >0
if "%Timer_Primary_Repeat_Counter_Value%" equ "1" if "%Timer_Primary_Second_Counter_Value%" gtr "0" start "" cmd /c "@echo off&timeout /t %Timer_Primary_Second_Counter_Value%&start "" cmd /c %User_Primary_Command%
::repeat =1 and timer =0
if "%Timer_Primary_Repeat_Counter_Value%" equ "1" if "%Timer_Primary_Second_Counter_Value%" equ "0" start "" cmd /c %User_Primary_Command%
 
That one does things, but not the previous one
 
@echo off
setlocal enabledelayedexpansion
set Timer_Primary_Repeat_Counter_Value=5
set Timer_Primary_Second_Counter_Value=3
set User_Primary_Command="echo Hello world!&echo(&pause"
set Timer_Secondary_Repeat_Counter_Value=%Timer_Primary_Repeat_Counter_Value%
for /l %%x in (1, 1, %Timer_Primary_Repeat_Counter_Value%) do (
echo !Timer_Secondary_Repeat_Counter_Value! repeats remain
set /a Timer_Secondary_Repeat_Counter_Value-=1
timeout /t %Timer_Primary_Second_Counter_Value%
cls
start "" cmd /c !User_Primary_Command!
Oh Maybe I miss type it
Or left some of it out when I was copying it
 
Ah, that works
@DavidPostill Are all batch variables on a line expanded immediately before that line's execution even if the line contains multiple commands?
I suspect that's the problem with the all-on-one-line approach
 
Really
So it can't work?
 
@BenN I'm not sure
 
6:17 PM
If my guess is correct, making it work would be very messy
But guess what can easily handle a bunch of things on one line without expanding early
Let me see if I can whip up a PS thing for this
 
Okay thanks
Really appreciate the help been working on this for over 6 hours now.
 
This multiline PS script has the right effect:
$repeats = 5
$delay = 3
$command = 'echo Hello world! & echo. & pause'
$repeats..1 | % {
	"$_ repeats remaining"
	Start-Sleep -Seconds $delay
	Start-Process cmd "/c $command"
}
And here it is all on one line:
$repeats = 5; $delay = 3; $command = 'echo Hello world! & echo. & pause'; $repeats..1 | % { "$_ repeats remaining"; Start-Sleep -Seconds $delay; Start-Process cmd "/c $command" }
 
Thnaks
Now Would it be possible to see how many seconds are remaning?
 
That's doable
 
6:32 PM
Julia Silge on January 16, 2017
I just started my new job here at Stack Overflow, and like most of us, one thing I think about when considering a career move is what kind of benefits a company offers. Firms looking to hire developers can create a company page here at Stack Overflow. This means that we here on the Data Team can explore what types of benefits companies offer developers and how those benefits change across companies of different sizes or in different locations. In this post, we'll use text mining and data visualization to investigate the benefits companies offer to the developers they hire.
 
@MathCubes $repeats = 5; $delay = 3; $command = 'echo Hello world! & echo. & pause'; cls; $repeats..1 | % { $repLeft = $_; $delay..1 | % {"$repLeft repeats remaining"; "$_ seconds before continuing"; sleep 1; cls}; Start-Process cmd "/c $command" }
 
Nice. I should really learn this.
 
:D
 
Didn't knew how powerful it was. I just thought it was just an extension on Batch that basically allow basic things to be done like edit the registry
 
Here are some examples of interesting things I've done with PowerShell
(shameless plug for my PS answers; please do not upvote them)
 
6:38 PM
Nice.
Now could you with this assign a key to exit the loop?
 
Ctrl+C will exit the entire script
 
Yea but I want to create a section of stuff to choose from.
 
When should that appear?
 
At the begainning
 
The Read-Host cmdlet takes user input
 
6:57 PM
Wow. The things you realise when a question piques your interest.
 
How do I make a file that is digitally signed
 
@MathCubes You need a signing certificate, which is kinda expensive. Is PowerShell giving you trouble about script execution rules?
 
yes
 
If so, do Set-ExecutionPolicy Unrestricted -Scope CurrentUser and it will let you run scripts
 
Thanks
 
7:17 PM
yay India is getting it's own NSA <3
 
7:35 PM
Oh that is just beautiful...
Sorry, spoiler... .
 
8:27 PM
@Burgi i've not forgotten :P
 
ironically i have
any context?
 
:D
Sherlock
I only remembered it becuase someone else mentioned it on facebook
 
oh!
ok good news
my sleep timer app is now working (needed .net 3.5)
@Mokubai i heard that donald trump's hair was actually born as a small dog in moldovia and as a result he can't be the US president
 
8:46 PM
@Burgi \o/
 
i know they are bad for me but i miss the win 7 gadgets
they are like rainbow drops
 
8:58 PM
 
10:12 PM
@tereško worrying
 
since my box runs on 8270, I see it more as "interesting"
 
@tereško you're running a HP scanner?
odd
 
:D
sorry
8370
I'm at the end of my second beer and starting to get bored
 
more beer?
 
Bob
@tereško U-series only, it says. So laptops mostly.
Then again...
> An attacker could change the BIOS configuration (for example, by using a Flash memory programmer) when they have physical access to the equipment during manufacturing, storage or usage.
 
10:24 PM
@Bob ... which also happen to be the devices, that get penetrated by various USB devices the most
 
Bob
As Raymond Chen would say, the attacker is already on the other side of the airtight hatchway...
If your attacker is to the point of modifying the firmware, I'd say you're probably already screwed.
 
10:39 PM
@tereško i followed your lead and got myself a beer
 
\o/
 
@tereško I wouldn't worry about it. If an attacker has physical access to the machine, you're screwed anyway.
 
if those were desktop CPUs, then I would agree
but it's laptop stuff
 
Bob
10:58 PM
@tereško was just adding info to a somewhat misleading/clickbaity title
 
11:19 PM
Sep 22 '16 at 14:04, by bwDraco
It's clickbait. Remember that they have a business to run; they need to be able to put food on the table. "'WT1190F' Safely Reenters Earth's Atmosphere" isn't going to attract many readers; "Mysterious Space Debris Hit Earth" will.
 
wtf?
 
@Burgi See context.
 
can you give me the headlines?
 
ah
you literally did give me the headlines then!
+1 ;)
 
11:46 PM
@Burgi that's vaguely offensive to small dogs and Moldovans
 

« first day (2355 days earlier)      last day (2662 days later) »