We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e95dcd commit 16b1558Copy full SHA for 16b1558
index.js
@@ -29,11 +29,16 @@ function generateCommands (filePaths, customLogger) {
29
for (let filePath of filePaths) {
30
const normalizedFile = normalizeFile(filePath, customLogger);
31
if (normalizedFile) {
32
+ // Escape (') and (’) in the file path for PowerShell syntax
33
+ const safeFilePath = normalizedFile
34
+ .replace(/'/g, "''")
35
+ .replace(/’/g, "’’");
36
+
37
const command = [
- '(New-Object -COM WScript.Shell).CreateShortcut(',
- filePath,
- ');'
- ].join('\'');
38
+ '(New-Object -COM WScript.Shell).CreateShortcut(\'',
39
+ safeFilePath,
40
+ '\');'
41
+ ].join('');
42
commands.push(command);
43
}
44
0 commit comments