Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 03-01-2013, 05:53 AM   #1
Fully Optimized
BikerEcho's Avatar
Join Date: Feb 2011
Location: Denmark
Posts: 4,026
Default Simple batch file help

I am trying to make a small batch file that calculate some stuff.

i am having trouble with this line of code: set /a result= %Minutes% / 300
echo %Minutes%

It will not show digits. like if the result is 3,20 it will only show 3. how can i get the ,20 in the result?

also if you have a line of code that can take the %time% and place the hours into one variable and minutes into another variable.
right now i am typing in the hours and minutes into 2 variable manually every time.

BikerEcho is offline   Reply With Quote
Old 03-01-2013, 06:13 PM   #2
Fully Optimized
strollin's Avatar
Join Date: Mar 2011
Location: USA
Posts: 2,623
Default Re: Simple batch file help

Calculations in batch files aren't impossible but they are complicated because, as you discovered, standard batch math can only work with whole numbers and no decimals. You can google for examples on how to do it but it's pretty involved. I'd suggest using a more robust scripting language such as Python to do it.
strollin is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 08:01 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0