Thursday, November 18, 2010

Windows7 msg command usage

In Windows7 there is no direct command like netsend. 
Here you can use "Msg" command for same purpose. 
you can create a .bat file with following and can  use it diectly. 
@echo off
cls
echo.
set choice=
set /p choice=Enter in the target hostname or IP:
set choice1=
set /p choice1=Enter in the Message:
msg /SERVER:%choice% console %choice1%
pause

But before that you have to make sure on remote pc where you are goin to send this message has enabled the following key: 

HKLM\System\CurrentControlSet\Control\Terminal Server
Dword=AllowRemoteRPC
Value=1

Check comma separated values exist within the column having comma separated data

If you want to select records from table which having match some text in comma sperated list given by user with the values within the column of table having also data in comma seperated manner you can do query over table like below.


Select * from Table1
WHERE          exists(select val from Split([Column1],',') where val in (select val from Split(@CommaSeperatedList,',') ))

Check For 64-bit OS

Check whether current application is running over 64-bit OS or not you can check with following way 
IsWow64Process function  is from the Kernel32 windows library. 
you can call it by 

Dim blnIs64bit  As Boolean 
Dim  blnSuccess As Boolean = IsWow64Process(Process.GetCurrentProcess().Handle, blnIs64bit)

Defination for IsWow64Process is as below : 
<DllImport("kernel32.dll", SetLastError:=True, CallingConvention:=CallingConvention.Winapi)> _
Public Shared Function IsWow64Process(<[In]()> ByVal hProcess As IntPtr, <Out()> ByRef lpSystemInfo As Boolean) As Boolean
End Function