Closed a84r7a3rga76fg closed 2 years ago
What did you use to save the PS1 ?
Also: you should have the target folder -d
in the config, everything that possibly can be needs to be in the config, preferably in 1 config, that being the main one, since you should be able to script the finer details.
If you need to use subconfigs, take a look at https://github.com/mikf/gallery-dl/issues/2164#issuecomment-1006944666
I used Notepad ++, I made sure it was saved as UTF-8 BOM too.
I think it has trouble with the non-ASCII characters (加瀬大輝), possibly due to encoding problems. Try replacing them with some simple ASCII characters as a test and see if it works with that.
BOM
That usually causes more trouble than it's worth. Try plain UTF-8 without BOM or your native system encoding.
Tried it with UTF-8, same issue as well. It's strange how typing this in the PS console "gallery-dl -d 'G:\rips gallery-dl\Artists Kemono\加瀬大輝' https://kemono.party/fanbox/user/273185" works just fine but not when it's in a PS1 file.
What is your exact Windows version (Like this: Version 10.0.19043.1706
)?
What is your PowerShell version ($PSVersionTable.PSVersion
)?
Also, can you give me the output of the following in your console?
[System.Console]::OutputEncoding
[System.Console]::InputEncoding
Windows 10, 21H2, Build 19044, 1706
IsSingleByte : True
BodyName : IBM437
EncodingName : OEM United States
HeaderName : IBM437
WebName : IBM437
WindowsCodePage : 1252
IsBrowserDisplay : False
IsBrowserSave : False
IsMailNewsDisplay : False
IsMailNewsSave : False
EncoderFallback : System.Text.InternalEncoderBestFitFallback
DecoderFallback : System.Text.InternalDecoderBestFitFallback
IsReadOnly : True
CodePage : 437
IsSingleByte : True
BodyName : IBM437
EncodingName : OEM United States
HeaderName : IBM437
WebName : IBM437
WindowsCodePage : 1252
IsBrowserDisplay : False
IsBrowserSave : False
IsMailNewsDisplay : False
IsMailNewsSave : False
EncoderFallback : System.Text.InternalEncoderBestFitFallback
DecoderFallback : System.Text.InternalDecoderBestFitFallback
IsReadOnly : True
CodePage : 437
Major Minor Build Revision
----- ----- ----- --------
5 1 19041 1682
Okay, Windows version is absolutely fine.
Your PowerShell version is still PS 5.1, aka "Windows PowerShell". That is also fine, it should work as well, is still officially supported etc. But, apparently, it does not seem to work straight out of the box.
So you can try one of the following two things:
Make the following changes to your $PROFILE file:
Test-Path $PROFILE
notepad $PROFILE
If not, create this file: New-Item -Path $PROFILE -ItemType File -Force
Careful, -Force
will create all missing directories in that path, but also overwrite a file should it already exist there.
Add these lines:
The output in your console should then show something like this:
PS D:\Temp>
>> [System.Console]::OutputEncoding
>> [System.Console]::InputEncoding
>>
Preamble :
BodyName : utf-8
EncodingName : Unicode (UTF-8)
HeaderName : utf-8
WebName : utf-8
WindowsCodePage : 1200
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
IsSingleByte : False
EncoderFallback : System.Text.EncoderReplacementFallback
DecoderFallback : System.Text.DecoderReplacementFallback
IsReadOnly : False
CodePage : 65001
Preamble :
BodyName : utf-8
EncodingName : Unicode (UTF-8)
HeaderName : utf-8
WebName : utf-8
WindowsCodePage : 1200
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
IsSingleByte : False
EncoderFallback : System.Text.EncoderReplacementFallback
DecoderFallback : System.Text.DecoderReplacementFallback
IsReadOnly : False
CodePage : 65001
PS D:\Temp>
Then you can try your URL again..
Can Powershell 7.2 be installed alongside the pre-installed Powershell?
Yes. Edit: That's even the default, i.e. it is supposed to be installed in parallel to the existing Windows PowerShell.
I downloaded the 7.2.4 zip package from here and extracted the content to C:\1 and dragged the PS1 file to pwsh.exe and it worked.
How do I create a profile that'll only be used by 7.2.4? Sorry for the noob question, I've just never done this before. Also, Test-Path $PROFILE
returned "False" in regular PS and 7.2.4.
Test-Path $PROFILE
returned "False" in regular PS and 7.2.4.
This simply means that a profile file does not exist, so nothing that gets automatically loaded into every PS session that you start. That is the default on every fresh system, so this is normal.
You can easily create the file with the line mentioned in my comment above (cf. point 2.iii).
The path for the new PowerShell is usually:
~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
Whereas the path for Windows PowerShell is:
~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
So they are loading the config from different paths by default, that's the point. But, the thing is, this might depend on your system settings, or if you are part of a domain network or something.
You can easily check by simply running $PROFILE
in your console.
To be more exact, $PROFILE
has four properties that each represent a different path it tries to load a configuration file from, you can pick whatever fits best to your needs, or simply use the path returned by just $PROFILE
.
(Which should be equal to $PROFILE.CurrentUserCurrentHost
)
This is what these properties looks like, for my PS 7:
AllUsersAllHosts NoteProperty string AllUsersAllHosts=C:\Program Files\PowerShell\7\profile.ps1
AllUsersCurrentHost NoteProperty string AllUsersCurrentHost=C:\Program Files\PowerShell\7\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts NoteProperty string CurrentUserAllHosts=C:\Users\Hrxn\OneDrive\Documents\PowerShell\profile.ps1
CurrentUserCurrentHost NoteProperty string CurrentUserCurrentHost=C:\Users\Hrxns\OneDrive\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
If you extract the ZIP package, you don't get an automatically created shortcut to launch PowerShell, unlike with the MSI installer (which is perfectly fine to use as well), so you have to create the shortcut yourself (a normal, standard Windows shortcut, which can be created for any file).
The correct target is, in your case, something like C:\1\pwsh.exe
You can also specify CLI options here, i.e. C:\1\pwsh.exe -NoLogo -SettingsFile <filePath> -WorkingDirectory <directoryPath>
and so on..
I've installed it with the MSI installer and this works well, thank you.
I saved this in a PS1 file
When I run the PS1 file, I'm getting this error
If someone knows the fix to this, please help me