masonwan
9/24/2013 - 7:25 AM

PowerShell script for running stuffs on Windows

PowerShell script for running stuffs on Windows

# From <http://blogs.msdn.com/b/powershell/archive/2007/06/19/get-scriptdirectory.aspx>
function Get-ScriptDirectory {
	$Invocation = (Get-Variable MyInvocation -Scope 1).Value
	Split-Path $Invocation.MyCommand.Path
}

$dir = Get-ScriptDirectory
$cmd = $dir + '\bin\mysqld.exe'
& $cmd
# Put the script in your MongoDB root directory to run it anywhere.

# From <http://blogs.msdn.com/b/powershell/archive/2007/06/19/get-scriptdirectory.aspx>
function Get-ScriptDirectory {
	$Invocation = (Get-Variable MyInvocation -Scope 1).Value
	Split-Path $Invocation.MyCommand.Path
}

$dir = Get-ScriptDirectory
$cmd = $dir + '\bin\mongod.exe'
$data = $dir + '\data'
& $cmd --dbpath $data
# From <http://blogs.msdn.com/b/powershell/archive/2007/06/19/get-scriptdirectory.aspx>
function Get-ScriptDirectory {
	$Invocation = (Get-Variable MyInvocation -Scope 1).Value
	Split-Path $Invocation.MyCommand.Path
}

$dir = Get-ScriptDirectory
$cmd = $dir + '\bin\mysqladmin.exe'
& $cmd -u root shutdown