Batch file help?

ashley268

New member
Local time
1:18 AM
Messages
2
Hello!
I am new to these forums and have a question about batch files...
...My batch is as follows:
Code:
(
echo <h1 style="color: red">HTML TEXT HERE</h1>
) > c:\Users\%username%\Desktop\htm.html
start iexplore file:\\c:\Users\%username%\Desktop\htm.html
The problem is, I cannot get it to work. When I load it, CMD opens up for a split second, and disappears. The file isn't made, and Internet Explorer will not open. I have tried to prtsc and get an image so I can see what the error is, but the window sometimes opens immediately, sometime after a few seconds, then goes away too quickly for me to get my bearings and push the button. Human reaction time too slow :(
Where has my script gone wrong?
 
Last edited:

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Lenovo
OS
Windows 8 Pro x64.
CPU
Intel I5
Memory
4 GB
Hard Drives
120GB Solid State
Antivirus
Kaspersky Endpoint Security 10
Browser
Opera
Try:
Code:
echo ^<h1 style="color: red"^>HTML TEXT HERE^</h1^> > c:\Users\%username%\Desktop\htm.html
c:\Users\%username%\Desktop\htm.html
If this is going to be used by lots of people, then you need different code for where to make the HTML file. Not every user has their desktop folder on the C: drive.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Thankyou, UsernameIssues!
Try:
Code:
echo ^<h1 style="color: red"^>HTML TEXT HERE^</h1^> > c:\Users\%username%\Desktop\htm.html
c:\Users\%username%\Desktop\htm.html
If this is going to be used by lots of people, then you need different code for where to make the HTML file. Not every user has their desktop folder on the C: drive.
That code worked for me.
As far as not everyone has desktop on C:\, I am aware of that. I myself have a PC which had %windir% on D:\.
For what I am doing, though, this will work. C:\ has the Desktop folder on every computer this will be used on.
Once again, Thanks!:D
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Lenovo
OS
Windows 8 Pro x64.
CPU
Intel I5
Memory
4 GB
Hard Drives
120GB Solid State
Antivirus
Kaspersky Endpoint Security 10
Browser
Opera
Back
Top