Link to home
Start Free TrialLog in
Avatar of David Sankovsky
David SankovskyFlag for Israel

asked on

batch file renaming and control flow

Hello experts.
I have two questions:
First, I have a batch file that in the process of running, renames a script like this:
for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "path\bananatemp.xlsx" "banana_%%f-%%e-%%g.xlsx"
Which gives me the file name with the date in which the script was invoked.
I need it to include the hour as well (up to minute level in 24h format, so if I would the script on the 29th of October, at 14:32, the file name would be banana_29-10-15_14-32.xlsx).

The other thing has to do with the control of the script. the very last line in the script, opens the report that the script generated. As long the excel is open on any computer, the script keeps running in the background while not actually doing anything because as far as the OS is concerned, it gave the control to the excel file.
I need a way to open the report, and yet to return the control to the script so that it could terminate without closing the report... Is that possible?
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David Sankovsky

ASKER

Excellend script!
Does exactly what I needed!! killed two birds with one stone!!
Thanks a lot :)