Escaping character in batch

Sometimes in Programming we can escape character by \. However in batch, the escape character is ^.

Example of the special characters are & (ampersand), < (less than) and > (greater than)

For example:

Escaping & would look like ^&

<html> would be ^<html^>

PS. Today I have to escape the url.

Advertisements

Change working directory in batch

Today I found that I need /d parameter to change directory in a batch file.

For example:

cd /d c:\java

It should look something like this during the execution:

c:>test.bat

c:\java>

Open a website in a browser from commandline

My attempt to open a website in command prompt or a batch file.

I found that, for Windows, I could run

explorer https://waoewaoe.wordpress.com

In batch script, I can do:

start explorer https://waoewaoe.wordpress.com

Ps. Actually, I don’t really have to use start 🙂

In Linux, we should be able to run

firefox https://waoewaoe.wordpress.com

(if there is Firefox)

Java JDK 6 also supports it using Browse class: http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#browse(java.net.URI)