Skip to content

Instantly share code, notes, and snippets.

@masonwan
Last active December 23, 2015 19:19
Show Gist options
  • Save masonwan/6681417 to your computer and use it in GitHub Desktop.
Save masonwan/6681417 to your computer and use it in GitHub Desktop.
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\mysqladmin.exe'
& $cmd -u root shutdown
# 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\mysqld.exe'
& $cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment