How do I use the following code in such a way that it will display what is indicated by the word "echo"?
if(exist chrome.exe $true)
echo internet is ready
else
echo get chrome!!
I want to use the above script to cause the shell to display either "internet is ready" or "get chrome!!" depending on whether or not a user has Chrome but the shell keeps giving the following error message.
Missing statement block after if ( condition ).
At line:2 char:1
What is a statement block, and how do I use it to display the text?
This might work okay in .BAT but I don't think so much in Powershell. You are trying to do an IF ( ) statement, but you have no parameters after that.
A pancake of how an IF statement works in Powershell:
If (statement -like "True") { Script info if condition is true } else { script info if condition is false }
In your case, you need to test the path of Chrome to see if it exsists. I don't have Chrome installed, but I do have IE. You just need to change the path to where the Chrome.exe is installed.
ps - the Echo equiv in Powershell is Write-Host
$TestBrowser = Test-Path "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
if ($TestBrowser -like "True")
Write-Host the internets is ready!
else
Write-Host the internets is not ready
Similiarly, you don't need to use $TestBrowser in your If ( ) statement, you can just use the operational param $?, which should return true or false depending on the last error message.
Similar Messages
-
How do I set the Track Header in such a way that both the solo and mute are turned off?
How do I set the Track Header in such a way that both the solo and mute are turned off?
Another possible solution is to use a battery grip on your 70D and see if the dial on the grip will change the shutter speed.
There are some discussions about this problem on some earlier models Canon DSLR. Check it out.
http://www.dpreview.com/forums/thread/2638326 -
When I receive an email with and HTML included I get the following message: "There are no parts that can be displayed inline", but no document to open.
== This happened ==
Every time Firefox opened
== a month agoI don't know. I don't have access to Iquest, and some searching on google for ''Iquest webmail "There are no parts that can be displayed inline"'' doesn't really turn up anything.
Does Iquest have their own support? -
hello,I ordered a cover for my iphone. this cover covers the iphone both ahead and behind, and has the magnet on the upper part in such a way that the cover closes. I want to ask if the magnet can cause damage ill'iphone. thanks
magnets can only harm magnetic storage not flash storage
-
I tried going to a site that I've never had problems loading before, and suddenly it says, "Page cannot load because the server is loading in such a way that it will never complete." or something along those lines. I've tried clearing my cookies, but the problem persists. Help!
If clearing the cookies doesn't help then it is possible that the file <i>cookies.sqlite</i> that stores the cookies is corrupted.
Rename (or delete) <b>cookies.sqlite</b> (cookies.sqlite.old) and delete <b>cookies.sqlite-journal</b> and <b>cookies.txt</b>, if they exist, in the Firefox Profile Folder in case the file cookies.sqlite got corrupted.
* http://kb.mozillazine.org/Profile_folder_-_Firefox
*Help > Troubleshooting Information > Profile Directory: Open Containing Folder -
Play zynga games and use the back arrow all the time, continuously using this doesnt seem to go well with firefox 4...firefox3.6 no problems. I get a none responsive page off and on and sometimes have to switch between firefox and chrome. The message is that the server is rerouting in such a way as it will never complete, suggestions have been to clear cookies etc which doesnt fix the problem.
This can be caused by corrupted cookies or cookies that are blocked (check the permissions on the about:permissions page).
*https://support.mozilla.org/kb/fix-login-issues-on-websites-require-passwords
Clear the cache and the cookies from websites that cause problems.
"Clear the Cache":
*Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
"Remove Cookies" from sites causing problems:
*Firefox/Tools > Options > Privacy > Cookies: "Show Cookies"
*http://kb.mozillazine.org/Cookies
*https://support.mozilla.org/kb/Deleting+cookies -
I've tried simply copying the project - but of course, that no longer contains the separate clips and audio used to create the project. Is there some export function I'm missing - or do I need to just gather up the clips and audio used in the project myself and send those?
Thanks.You need to export your project via the Share command.
Share > Export Movie.... (or Share > Export using QuickTime).
That will render your project (combine and set all the events, stills, audio etc).
When completed you can then take that exported file and import it into iMovie on another computer (or back into your own) as a new Event.
You can then start a new project, load that event file and continue editing.
Z. -
If I am planning on buying a macbook and my parent is an educator, therefor I would get a discount... If my parent does not come with me to buy it is there any way that I can still receive the discount?
If you are a college student and take a student ID you will get the education discount. If you are a student in public or private high school and have a student ID you may get the discount. I know of some parents/students who claim to have gotten the discount and some who have been denied it. Not sure if that's due to a policy change or just a difference in interpretation of who is eligible. I suggest you call your local store to find out.
-
Yesterday I noticed that my mbp 2011 dos not sleep when closing the screen cover. Today I Turner my laptop in. However the fan was working loudly and stayed loud. After Start I noticed an X on Battery symbol. Clicking on it, it showed 'no battery.' I found out that a potential solution for this problem was SMC reset. I also noticed that the leds on magsafe was not lightning. Despite this I tried to execute the smc reset as described on apple support site. Switching off, plugin the magsafe connector, pushed the buttons shift + alt+ ctrl + power. Then i pushed the power button, but my mbp is not turning on. I pushed several times on the power button but nothing works. The magsafe is also dark meaning the leds not lightning. Can anyone here help me on this ?
Problem solved by my own. But do not how :) magsafe again working and the laptop tooo
-
how to organise(and save) Lightroom catalogue, in such a way that the catalogue can be used on another computer? / so you can see what has been edited etc. /
Yes, but external disks will always be slower than internal drives.
Look into file synchronization software. As long as folder structure is identical inside the two master folders, and drive letters the same, you can keep the two machines fully synchronized very easily, going both ways. The one I use cost about $50 or so.
Use a large capacity 2,5" portable (goes in your pocket) for transport. You need the entire master folder there, but once set up only new or modified files are copied.
The Lightroom catalog can be synchronized with the rest, so that you are working with the same catalog on both machines. This overwrites the catalog with a new copy every time, so a regular backup schedule in addition is a must. OTOH you will have three copies of every file, one always off-site. That's sound backup practice.
Tip: exclude the Lr Previews folder from the synchronization. They are written to disk in such a way that they take an insanely long time to copy. New previews will be built on the receiving machine. -
Every time I enter the redemption code I get a message that it is invalid
every time I enter the redemption code I get a message that it is invalid
if you are downloading from the Adobe site, your antivirus software may be giving a false positive. Is it up to date ?
-
Why use *31L in the following code?
Why use *31L in the following code?
* {@inheritDoc}
public int hashCode()
return (int) ((long) getAreaCode() * 31L + getLocalNumber());
public class PhoneNumber
implements PortableObject
// ----- constructors ---------------------------------------------------
* Default constructor (necessary for PortableObject implementation).
public PhoneNumber()
* Construct a Phone.
* @param nAccessCode the numbers used to access international or
* non-local calls
* @param nCountryCode the numbers used to designate a country
* @param nAreaCode the numbers used to indicate a geographical region
* @param lLocalNumber the local numbers
public PhoneNumber(short nAccessCode, short nCountryCode,
short nAreaCode, long lLocalNumber)
m_nAccessCode = nAccessCode;
m_nCountryCode = nCountryCode;
m_nAreaCode = nAreaCode;
m_lLocalNumber = lLocalNumber;
// ----- accessors ------------------------------------------------------
* Return the access code.
* @return the access code
public short getAccessCode()
return m_nAccessCode;
* Set the numbers used to access international or non-local calls.
* @param nAccessCode the access code numbers
public void setAccessCode(short nAccessCode)
m_nAccessCode = nAccessCode;
* Return the country code.
* @return the country code
public short getCountryCode()
return m_nCountryCode;
* Set the country code.
* @param nCountryCode the country code
public void setCountryCode(short nCountryCode)
m_nCountryCode = nCountryCode;
* Return the area code.
* @return the area code
public short getAreaCode()
return m_nAreaCode;
* Set the numbers used indicate a geographic area within a country.
* @param nAreaCode the area code
public void setAreaCode(short nAreaCode)
m_nAreaCode = nAreaCode;
* Return the local or subscriber number.
* @return the local or subscriber number
public long getLocalNumber()
return m_lLocalNumber;
* Set the local or subscriber number.
* @param lLocalNumbeer the local or subscriber number
public void setLocalNumber(long lLocalNumbeer)
m_lLocalNumber = lLocalNumbeer;
// ----- PortableObject interface ---------------------------------------
* {@inheritDoc}
public void readExternal(PofReader reader)
throws IOException
m_nAccessCode = reader.readShort(ACCESS_CODE);
m_nCountryCode = reader.readShort(COUNTRY_CODE);
m_nAreaCode = reader.readShort(AREA_CODE);
m_lLocalNumber = reader.readLong(LOCAL_NUMBER);
* {@inheritDoc}
public void writeExternal(PofWriter writer)
throws IOException
writer.writeShort(ACCESS_CODE, m_nAccessCode);
writer.writeShort(COUNTRY_CODE, m_nCountryCode);
writer.writeShort(AREA_CODE, m_nAreaCode);
writer.writeLong(LOCAL_NUMBER, m_lLocalNumber);
// ----- Object methods -------------------------------------------------
* {@inheritDoc}
public boolean equals(Object oThat)
if (this == oThat)
return true;
if (oThat == null)
return false;
PhoneNumber that = (PhoneNumber) oThat;
return getAccessCode() == that.getAccessCode() &&
getCountryCode() == that.getCountryCode() &&
getAreaCode() == that.getAreaCode() &&
getLocalNumber() == that.getLocalNumber();
* {@inheritDoc}
public int hashCode()
return (int) ((long) getAreaCode() * 31L + getLocalNumber());
* {@inheritDoc}
public String toString()
return "+" + getAccessCode() + " " + getCountryCode() + " "
+ getAreaCode() + " " + getLocalNumber();
...31 is a nice prime number that is used here to decrease hash collisions
thanks,
-Rob -
How to display rectangles with the following code in a JPanel?
I am trying to make a bunch of random rectangles appear inside a JPanel on a GUI form. Im not sire how to display the form and panel with random rectangles. I have in my package the MyRectangle class, a blank JForm class called RectGUI and the class for the panel RectGUIPanel. The following code is from my panel and it should create random rectangles okay but how do I display them inside of a Panel on my RectGUI form? Thanks for the assistance.
//Declare variables
private int x;
private int y;
private int width;
private int height;
private Color color;
Random rand = new Random();
public class RectanglePanel extends JPanel
public void displayRectangles()
// Declare an arraylist of MyRectangles
ArrayList<MyRectangle> myArray = new ArrayList<MyRectangle>();
int maxNumber = 300;
// Declare Frame and Panel
JFrame frame = new JFrame();
Container pane = frame.getContentPane();
RectanglePanel rect = new RectanglePanel();
// Set Frame attributes
frame.setSize(700, 500);
frame.setLocation(100,100);
frame.setAlwaysOnTop(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle(" Rectangle Program");
frame.setVisible(true);
for (int i = 0; i < maxNumber; i++)
MyRectangle rec = createRandomRec();
myArray.add(rec);
rect.repaint();
public MyRectangle createRandomRec()
x = rand.nextInt();
y = rand.nextInt();
width = rand.nextInt();
height = rand.nextInt();
color = new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
return new MyRectangle(x, y , width, height, color);
}I am trying to make a bunch of random rectangles appear inside a JPanel on a GUI form. Im not sire how to display the form and panel with random rectangles. I have in my package the MyRectangle class, a blank JForm class called RectGUI and the class for the panel RectGUIPanel. The following code is from my panel and it should create random rectangles okay but how do I display them inside of a Panel on my RectGUI form? Thanks for the assistance.
//Declare variables
private int x;
private int y;
private int width;
private int height;
private Color color;
Random rand = new Random();
public class RectanglePanel extends JPanel
public void displayRectangles()
// Declare an arraylist of MyRectangles
ArrayList<MyRectangle> myArray = new ArrayList<MyRectangle>();
int maxNumber = 300;
// Declare Frame and Panel
JFrame frame = new JFrame();
Container pane = frame.getContentPane();
RectanglePanel rect = new RectanglePanel();
// Set Frame attributes
frame.setSize(700, 500);
frame.setLocation(100,100);
frame.setAlwaysOnTop(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle(" Rectangle Program");
frame.setVisible(true);
for (int i = 0; i < maxNumber; i++)
MyRectangle rec = createRandomRec();
myArray.add(rec);
rect.repaint();
public MyRectangle createRandomRec()
x = rand.nextInt();
y = rand.nextInt();
width = rand.nextInt();
height = rand.nextInt();
color = new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
return new MyRectangle(x, y , width, height, color);
} -
How to interrupt an funtion call and continue the followed code?
for example, the code:
public class A{
public static void main(String[] args){
int i = 0;
method1();
system.out.println("exit");
public void method1(){
int j = 0;
while(true){
j +=1;
there is a error in method1(), so the call the method1( ) in main() will make an error.
how can i interrupt this funtion call and continue the followed code?in actually, I can not control the method1(), that's
an remote object function.
So I can not add exception in methoes().Then in your main method catch whatever "Error" your method1 is throwing. -
Hi, folks can some body help me¡ How I can use de second code to the Itunes card to use the Itunes card.... My number is vanished, how i can submit my Itunes card?
iTunes Store: Invalid, inactive, or illegible codes
http://support.apple.com/kb/TS1292
Maybe you are looking for
-
Inline display of error message for a regular expression validation
Hi All, I am using ApexLib in my application. I am using regular expression validation for some of the items. Those validation will happen when the button is pressed and the message will be displayed as per the error. But, I want the errors to be dis
-
Where to find the pcui_gp components ,How to get the source code of those
Hi All, Can anybody tell the exact location wher the pcui_gp components will be stored if they are not appearing. And another question is how to get the source code of the pcui_gp for customization. anybody working on these compoents please help me.
-
ICal crash with Exchange Server 2007
We started using a MS Exchange Server recently for our agenda's. I'm using iCal for years in MobileMe connection, without any problem. Now iCal crashes every few minutes. Can anybody explain me where the problem might be?
-
UCCX 9.0 real-time reporting
Hi, I need information about UCCX 9.0 real-time reporting. What are the real time reports available on UCCX 9.0. How to run this real time reports. Regards, Dinesh Joshi
-
Turn off auto-correction selectively ?
I really like the auto correction of typing - sometimes. Other times it is totally annoying. (The worst for me is that my name is Mitch and it always "corrects" it to Match and then I have to retype it.). I wish there were a way to tell it to NOT cor