Skip to content

Commit d17486b

Browse files
committed
NPMAsAdmin
1 parent f3c2083 commit d17486b

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

NPMAsAdmin.lnk

2.85 KB
Binary file not shown.

NPMAsAdmin.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Start-Process PowerShell -WorkingDirectory $pwd -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd';'$pwd'; & '.\NPlusMiner.ps1';`"";

NPlusMiner.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ Add-Type -AssemblyName System.Windows.Forms
572572
# $SwitchingArray = [System.Collections.ArrayList]@($Log)
573573
If (Test-Path ".\Logs\switching.log"){$SwitchingArray = [System.Collections.ArrayList]@(Import-Csv ".\Logs\switching.log" | Select -Last 14)}
574574

575+
[environment]::currentdirectory = (Split-Path $script:MyInvocation.MyCommand.Path)
576+
575577
$MainForm = New-Object system.Windows.Forms.Form
576578
$NPMIcon = New-Object system.drawing.icon (".\Includes\NPM.ICO")
577579
$MainForm.Icon = $NPMIcon
@@ -2110,8 +2112,6 @@ $ButtonStart.Add_Click( {
21102112

21112113

21122114
$ShowWindow = Add-Type -MemberDefinition '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);' -Name Win32ShowWindowAsync -Namespace Win32Functions -PassThru
2113-
$ParentPID = (Get-CimInstance -Class Win32_Process -Filter "ProcessID = $pid").ParentProcessId
2114-
$ConsoleHandle = (Get-Process -Id $ParentPID).MainWindowHandle
21152115
$ConsoleHandle = (Get-Process -Id $pid).MainWindowHandle
21162116

21172117
$MainForm.controls.AddRange($MainFormControls)

0 commit comments

Comments
 (0)