Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create file with current date 1

Status
Not open for further replies.

NTesla1886

Technical User
Mar 14, 2008
62
US
I have a client that wants to know every website his employees are visiting. I am using IEHV by nirsoft. I will be running the script every day when the user logs off their computer for the day.

I will map a network drive write the necessary file in a different folder for each user then delete the network drive

I want to create the file with its name being the current date. I have been able to store the current date in a variable but it is in the format 'Fri 07/17/2009'. My problem is the '/'. As everyone knows folder and file names cannot contain the '/'. My question is how do I get rid of '/' and replace it with either hyphens or periods or what ever

I do not have power-shell installed, I am trying to use command prompt if I can. What I have so far is:

@echo off
Net use v: \\Server\D\Temp\%username%
set today=%date%

iehv.exe /shtml "v:\%today%.html"

net use v: /delete /y

Right now all I get is an unknown file type with the name 'Fri'

Any help would be greatly appreciated
 
Try this instead:
Code:
rem Set variable for the date in YYYY-MM-DD format
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set today=%%l-%%j-%%k

iehv.exe /shtml "v:\%today%.html"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top