473,569 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to increment a value in a txt file in BATCH.

2 New Member
Dear Bytes Community,

First of all I would like to thank you in advance for helping me.

I have been trying to write a batch code that will:

1. Auto execute after POST.
2. Increment a value that is suppose to represent number of the POSTs.
3. Save, display the value and restart the PC.

I have tried to write one that access a txt file for the value; however the value does not increment.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. @echo off
  4.  
  5. echo.This script is counting the # of POSTs.
  6.  
  7. cd "C:\Users\HP-M6\Documents"
  8. for /f "tokens=* delims=" %%x in (TEST.txt)  do echo %%x
  9.  
  10. call:myPOSTTest
  11.  
  12. for /f "tokens=* delims=" %%x in (TEST.txt)  do echo %%x
  13.  
  14.  
  15. echo.&pause&goto:eof
  16.  
  17.  
  18. ::--------------------------------------------------------
  19. ::-- Function section starts below here
  20. ::--------------------------------------------------------
  21. -- 
  22. :myPOSTTest    - here starts my function identified by it's label
  23.  
  24.  
  25. cd "C:\Users\HP-M6\Documents"
  26.  
  27. for /f "tokens=* delims=" %%x in (TEST.txt) do (
  28.  
  29. set %x%+=1
  30.  
  31. )
  32.  
  33.  
  34. goto:eof
  35.  
  36.  
  37.  
Jan 13 '14 #1
1 1644
ryno du preez
91 New Member
We need more info
What must auto execute? after posting What?
Do you want the batch to write to a text file and auto increment a colum like 1 2 3 ect.
Mar 3 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
18266
MMcCarthy
by: MMcCarthy | last post by:
This is a module that imports information to a Query or a Table from comma separated values file in a text format! It is very helpful for getting information from other applications and from files! The function that does this work is: import_csv_file_to_SQL(File_name, SQL, Optional text_delimiter, Optional Field_delimiter) Parameters:...
9
10986
by: hribek25 | last post by:
Hello folks, is there any way how to create autoincrement value in query? So every line of my result of query will have values 1,2,3 etc.? Thank you in advance. Petr
5
9346
by: ronenbenchamo | last post by:
Hi All, I would like to run a batch file from perl and ger the reutun value from the batch file, How can I do it? I try to run system or exec but it didn’t work Any idea? $val=system("test.bat");
2
1792
by: dkhansoft | last post by:
hi, i have created one table called user_details for this table there is one column called uid,which should increment automatically,when ever i insert values for this i have create table by using auto_increment,table created seccussfully, bt if i insert values into this table by excluding tat uid(which is increment automatically),it is...
5
2657
by: Germaris | last post by:
Hi there! How should I write a query to get the next auto-increment value of a table? Many thanks in advance for any help. Best regards, Gerry
3
2448
by: vbnewbie1217 | last post by:
All, I am trying to have the file name of a document increment +1 each time a file is saved in word. See the code below: Private Sub OpenBlankDoc(ByVal DocumentName As String, ByVal wrdApp As Object, ByVal wrdDoc As Object) Dim sourcePathName As String Dim outputPathName As String wrdApp.Visible = True
1
4220
AaronL
by: AaronL | last post by:
Hello, First I would like to say thank you all for your help in the past. I am stumped again. I am creating an e-commerce system and I want to be able to upload images to the server and assign them to products. For the product ID, I have an auto increment value for the primary key to avoid duplicate item numbers. Since I do not want to...
7
11098
by: Salin786 | last post by:
I have a text box invoice no on windows form and i need to retrieve data from database and everytime user click on the add button the invoice no should increment by 1
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.