Ready, steady… save!
You don’t need a chart to join in. Here are 2 ways to record your savings:
1. Cross it off
Pop a chart into your first post. Saved an amount? Cross it out! Read more »
£0.01 £0.02 £0.03
2. Write it down
Skip the chart and add updates to your first post. Read more »
“Another +£3 saved today. Go me!”
Use +£ before each new saving so it counts towards your total.
We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
Batch File Help!
schnadi_uk
Posts: 27 Forumite
in Techie Stuff
Could anyone help me with a small problem i have...
OK...what i'm after achieving is to simply create a small batch file which copys a named dat file. For example, I would like to copy a file called C:\temp\Paul110.dat to C:\temp\august.dat i can do this manually but thought i'd seek some assistance after trying unsuccessfully to do this is a batch file
What i want my batch file to do is prompt me for a file number which in this case is 110 and to copy the data to C:\temp\august.dat
I'd do this on a weekly or monthly basis probably.
All help appreciated.
Thanks,
Paul
OK...what i'm after achieving is to simply create a small batch file which copys a named dat file. For example, I would like to copy a file called C:\temp\Paul110.dat to C:\temp\august.dat i can do this manually but thought i'd seek some assistance after trying unsuccessfully to do this is a batch file
What i want my batch file to do is prompt me for a file number which in this case is 110 and to copy the data to C:\temp\august.dat
I'd do this on a weekly or monthly basis probably.
All help appreciated.
Thanks,
Paul
0
Comments
-
Paul
So paul110.dat is copied and the new file becomes august.dat, leaving paul110.dat as it was?
And you want the batch file to ask you which version of the paul###.dat file you wish to copy?
Whatshould happen to the august.dat file when you try and copy the paul###.dat file a second time?0 -
Something like:
setlocal set /P filenum=Please enter file number: if "%filenum%" == "" exit /B copy C:\temp\Paul%filenum%.dat C:\temp\august.dat
0 -
Sorry...think I should have been clearer.
What I want to do is double click the batch file...it would then prompt me for the file number and create a copy of this file.
So far I have come up with this:
I:
cd "\Info\Data\PJTest"
COPY CDSWOD__%1.dat Extract.dat
This works fine if i open the command prompt and pass a parameter to the batch file but i would like it to run with more automation by clicking on the batch file and entering the file number.
My reason for doing this is that I am linking the extract.dat file into a MS Access database and by coping the file to Extract.dat is will solve the problem of having to relink.
Thanks,
Paul0 -
Yep, ok, I see.
I think Chippy has got the code for you then.0 -
If you want the batch file to accept an optional file number parameter and prompt for it if not supplied:
setlocal set filenum=%1 if "%filenum%" == "" set /p filenum=Please enter file number: if "%filenum%" == "" exit /B copy C:\temp\Paul%filenum%.dat C:\temp\august.dat
For more flexibility and a tidier user interface, use VBScript or JScript instead of DOS batch language.0 -
Thanks for your help on this!! Much appreciated :T0
-
Would you mind explaining what the /B and /P do?0
-
set /P prompts for a value and sets the variable to that value.
exit /B exits the current batch script instead of the command window. Useful if you've opened a command window and are running the batch script from there.
Type help set and help exit from a command prompt for more info.0
This discussion has been closed.
Categories
- All Categories
- 356K Banking & Borrowing
- 255K Reduce Debt & Boost Income
- 456.3K Spending & Discounts
- 248.5K Work, Benefits & Business
- 606.4K Mortgages, Homes & Bills
- 179.1K Life & Family
- 264.2K Travel & Transport
- 1.6M Hobbies & Leisure
- 16.2K Discuss & Feedback
- 37.7K Read-Only Boards