Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to run a .bat file from a vb.net app in Windows Mobile?

Posted on 2014-09-04
7
Medium Priority
?
394 Views
Last Modified: 2014-10-10
For years we have been using the code below to run a batch file on a shared LAN network drive, running our warehouse app on the Motorola 9190 with Windows CE:

        Try
           
            psWork8 = "\\accserv2008\c\ginscanfiles\runwx.bat"

            Dim myProcess As Process = System.Diagnostics.Process.Start(psWork8, "0")

            myProcess.WaitForExit()

        Catch ex As Exception
            psWork4 = "Cannot run process file!"
            GoTo Err2
        End Try

But now when I try to do this same thing running on the Motorola MC67 with Windows Embedded Mobile 6.5, the procedure will no longer work, and I get that error.

The scanner definitely IS properly connected to the LAN share wirelessly.  In fact, some previous statements actually copy files from the scanner to the share, and that part works fine.  Apparently it is dying on the "Dim myProcess" statement, according to multiple messagebox.show commands I inserted for testing.  I don’t know what the actual error is, because as you can see, I have inserted a user-friendly message in the catch area.  If I should find out what the exact error is, what kind of syntax should I use in the catch area in place of my comment about "Cannot run process file!'?

This is the exact same code I use in our warehouse app that runs on Motorola 9190s using Windows CE with no problem.  It has worked fine for years.  That’s where I got this code, adding it to my new app running on the MC67 with WM 6.5.

The next test I did was to deploy my warehouse app on the MC67, and I found that it errors out exactly the same way.  Not so on a 9190 on CE6; it fails only on the MC67 running WM 6.5.  So, all this makes me think maybe there is some kind of gotcha with WM 6.5.

Next I changed it to run a batch file locally on the scanner itself, in \my documents, just in case this is a network issue.  But I got the same error, where the try-catch errors out and shows my “Cannot run process file” message.  This makes me wonder if maybe WM 6.5 doesn’t like running .bat files any more, or something along that line.  

Has Microsoft somehow taken away the ability to run a batch file from WM 6.5?  If that is what this is all about, what can be done to replace that functionality?  TIA
0
Comment
Question by:sasllc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40305594
It would be much more use to see the details of ex as a dump so that you knew exactly what Exception was thrown.
0
 
LVL 3

Author Comment

by:sasllc
ID: 40305600
I agree, but I don't exactly know what to key in the catch area.  What code can I use to do this?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40311750
Change

psWork4 = "Cannot run process file!"

to

psWork4 = "Cannot run process file! because: " & ex.ToString
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:sasllc
ID: 40318326
Here is what it says...Cannot run process file because:

System.Component.Model.Win32Exception:

Win32Excepton at System.Diagnostics.Process.StartWithShellExecuteEX(ProcessStartInfo startInfo) at....... etc.

This looks very generic to me--with my limited knowledge.  Does this actually tell me anything useful and helpful, so I can fix the problem--assuming it is fixable?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40333930
Yeah does not tell much. Has anything changed on the LAN share in terms of folder name, permissions, users etc?
0
 
LVL 3

Accepted Solution

by:
sasllc earned 0 total points
ID: 40362444
Nothing has changed.  I can run this just fine using a CE-based scanner, but not with a WM 6.5-based scanner--on the same network.  I guess MS has changed things and there is no hope.
0
 
LVL 3

Author Closing Comment

by:sasllc
ID: 40372508
No one was aware of any usable answers.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question