Skip to content

Commit dae226d

Browse files
committed
Move scripts from ‘C:\Windows\Temp’ to ‘C:\Windows\Setup\Scripts’
#18
1 parent 2bbf814 commit dae226d

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

modifier/Bloatware.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void Save(BloatwareModifier parent)
2020
{
2121
return;
2222
}
23-
string scriptPath = @$"C:\Windows\Temp\{BaseName}.ps1";
23+
string scriptPath = @$"C:\Windows\Setup\Scripts\{BaseName}.ps1";
2424
parent.AddTextFile(GetRemoveCommand(), scriptPath);
2525
parent.SpecializeScript.InvokeFile(scriptPath);
2626
}
@@ -38,7 +38,7 @@ private string GetRemoveCommand()
3838
sw.WriteLine($"$filterCommand = {FilterCommand};");
3939
sw.WriteLine($"$removeCommand = {RemoveCommand};");
4040
sw.WriteLine($"$type = '{Type}';");
41-
sw.WriteLine($@"$logfile = 'C:\Windows\Temp\{BaseName}.log';");
41+
sw.WriteLine($@"$logfile = 'C:\Windows\Setup\Scripts\{BaseName}.log';");
4242
return sw.ToString() + Util.StringFromResource("RemoveBloatware.ps1");
4343
}
4444

@@ -80,7 +80,7 @@ class PackageRemover : Remover<PackageBloatwareStep>
8080
}
8181
""";
8282

83-
protected override string BaseName => "remove-packages";
83+
protected override string BaseName => "RemovePackages";
8484

8585
protected override string Type => "Package";
8686
}
@@ -115,7 +115,7 @@ class CapabilityRemover : Remover<CapabilityBloatwareStep>
115115
}
116116
""";
117117

118-
protected override string BaseName => "remove-caps";
118+
protected override string BaseName => "RemoveCapabilities";
119119

120120
protected override string Type => "Capability";
121121
}
@@ -150,7 +150,7 @@ class FeatureRemover : Remover<OptionalFeatureBloatwareStep>
150150
}
151151
""";
152152

153-
protected override string BaseName => "remove-features";
153+
protected override string BaseName => "RemoveFeatures";
154154

155155
protected override string Type => "Feature";
156156
}

modifier/Wdac.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ void NewPathRule(string path, RuleType type)
130130
} catch {
131131
$_;
132132
}
133-
) *>&1 | Out-File -Append -FilePath "$env:TEMP\wdac.log";
133+
) *>&1 | Out-File -Append -FilePath 'C:\Windows\Setup\Scripts\Wdac.log"';
134134
""");
135135

136-
string ps1File = @"C:\Windows\Setup\Scripts\wdac.ps1";
136+
string ps1File = @"C:\Windows\Setup\Scripts\Wdac.ps1";
137137
AddTextFile(sw.ToString(), ps1File);
138138
SpecializeScript.InvokeFile(ps1File);
139139
}

modifier/Wifi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void AddWifiProfile(IProfileWifiSettings settings)
214214
throw new ConfigurationException($"WLAN profile XML is invalid: {e.Message}");
215215
}
216216

217-
string xmlfile = @"C:\Windows\Setup\Scripts\wifi.xml";
217+
string xmlfile = @"C:\Windows\Setup\Scripts\Wifi.xml";
218218
AddXmlFile(profile, xmlfile);
219219

220220
SpecializeScript.Append($"""

resource/ExtractScripts.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ param(
22
[xml] $Document
33
);
44

5-
$scriptsDir = 'C:\Windows\Setup\Scripts\';
65
foreach( $file in $Document.unattend.Extensions.File ) {
76
$path = [System.Environment]::ExpandEnvironmentVariables(
87
$file.GetAttribute( 'path' )
98
);
10-
if( $path.StartsWith( $scriptsDir ) ) {
11-
mkdir -Path $scriptsDir -ErrorAction 'SilentlyContinue';
12-
}
9+
mkdir -Path( $path | Split-Path -Parent ) -ErrorAction 'SilentlyContinue';
1310
$encoding = switch( [System.IO.Path]::GetExtension( $path ) ) {
1411
{ $_ -in '.ps1', '.xml' } { [System.Text.Encoding]::UTF8; }
1512
{ $_ -in '.reg', '.vbs', '.js' } { [System.Text.UnicodeEncoding]::new( $false, $true ); }

resource/VBoxGuestAdditions.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
}
1010
}
1111
'VBoxGuestAdditions.iso is not attached to this VM.';
12-
} *>&1 >> "$env:TEMP\VBoxGuestAdditions.log";
12+
} *>&1 >> 'C:\Windows\Setup\Scripts\VBoxGuestAdditions.log';

resource/VirtIoGuestTools.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
}
88
}
99
'VirtIO Guest Tools image (virtio-win-*.iso) is not attached to this VM.';
10-
} *>&1 >> "$env:TEMP\VirtIoGuestTools.log";
10+
} *>&1 >> 'C:\Windows\Setup\Scripts\VirtIoGuestTools.log';

0 commit comments

Comments
 (0)