473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

VB exe and batch file question.

hi,
I have this situation here,
I need to call a VB application (which i can code), which does some
calculations on some dates and returns a date value.
For simplicity lets say, i pass a date to the VB app as command line
arguments, my vb app should return me a date 15 days earlier.
I will call this vb app from a batch file, how do i return a date value from
the VB app and assign it to a variable in my dos batch script, so that i can
use the returned date value for some actions to be performed.

Thanks for any responses.
--
Kannan.V
Home : http://www.kannanv.com
Blog : http://kannanv.blogspot.com
Web : http://www.DotnetLounge.net

"Any one who has never made a mistake has never tried anything new" - Einstein
Nov 21 '05 #1
1 1902
Hi,

There's API that might help you:

Private Declare Auto Function SetEnvironmentVariable Lib "kernel32.dll"
( _
<MarshalAs(UnmanagedType.LPTStr)> ByVal Name As String, _
<MarshalAs(UnmanagedType.LPTStr)> ByVal Value As String _
) As Boolean

I assume you can guess how to use it. 8=]
However, this function sets envvar only in calling process, so if you
call your .bat from your app it will work, but when aplication exits,
variable will be lost.

Another approach:
You can set the registry key at HKEY_CURRENT_USER\Environment and then
send WM_WININICHANGE message to HWND_BROADCAST with lParam equals to
"Environment", so each application will reload envvars. Though, I
haven't tested this, and you will get permanent envvar.

One more way:
You can use exit code of your application; set it via
Environment.Exit(code), and retrieve as %ERRORLEVEL%. However, it won't
work in Win9x, since there's no %ERRORLEVEL% variable.

Hope this helps a three little bits. 8=]

Roman

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: carrot | last post by:
With .Net Studio, I have a solution includes some projects. I want to execute a batch file during build solution time. For example, 1'st project is builded. 2'nd project is builded. " a batch...
3
by: KRK | last post by:
I am having one batch file and using this I can start my Server. It will execute all exes while starting. Now my question is how to debug my exe using this batch file?? Is it possible to execute this...
2
by: Stephen | last post by:
Hi all, I want to create an app that runs a batch file which inturn runs applications. question: if I start the batch file from app1, how can app1 know that the batch file ran successfully...
4
by: Shiraz | last post by:
Hi I'm using Visual Studio Installer to make my installer, and have not as yet figured out a straightforward way to use it to set environmental variables. Amongst the various things I tried, I'm...
4
by: | last post by:
Hello, I am attempting to convert multiple .wav files to the .flac format via a batch script. I know that this can be done with numerous software implementations automatically for me; however, i am...
4
ck9663
by: ck9663 | last post by:
hi guys this is a little challenging, at least for me...here goes... i have to run a DOS batch file from a server. with some parameters that i need to pass. these parameters can be found on a...
1
benchpolo
by: benchpolo | last post by:
I'm not sure if this is the right section to post my question regarding FTP Batch scripting. Question? I have multiple textfiles where the filename is dynamically changing daily. For example, ...
0
by: gabrielk43 | last post by:
Hi to all, I have made a web service which creates a batch file in a folder in web server and tries to execute it (in a Windows Server 2003 web server). So far I have managed to create the batch...
14
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in...
1
by: raviva | last post by:
Hi, I have a question regarding the batch file. When that batch file is run, its ftps a csv file from windows to oracle end(ours is on unix platform). This is quite simple right?? But there are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.