Search found 15357 matches
- Wed Feb 01, 2023 3:00 pm
- Forum: PowerShell
- Topic: New-PSDrive : Unable to use a variable in root parameter
- Replies: 1
- Views: 435
Re: New-PSDrive : Unable to use a variable in root parameter
If the path is not found, then it is likely that you have an error in you string or you have no access to the path. Also be careful of how you construct path strings using string expansion. "$" can cause issues with the expansion. The following method would be safer: $path = '\\' + $label1...
- Tue Jan 31, 2023 2:55 pm
- Forum: PowerShell
- Topic: script file "self destruct" on compiled EXE file
- Replies: 3
- Views: 1841
Re: script file "self destruct" on compiled EXE file
No. The file you are running is in the EXE so that would make no sense. There would be no PS1 file in the folder. Why would you copy a PS1 and embed the same file into an EXE?
- Sun Jan 29, 2023 2:49 pm
- Forum: PowerShell
- Topic: Tree folder/sub-folder/files archive issues...
- Replies: 1
- Views: 436
Re: Tree folder/sub-folder/files archive issues...
Pick one thing that doesn't work and let's try to understand what you are seeing. Just saying it doesn't work doesn't provide any useful information.
To scatter-add to an archive I suggest adding the files to an array then piping the array to "Compress-Archive".
To scatter-add to an archive I suggest adding the files to an array then piping the array to "Compress-Archive".
- Sat Jan 21, 2023 4:40 pm
- Forum: PowerShell
- Topic: Trouble Converting a multi-line string to a single line
- Replies: 4
- Views: 975
Re: Trouble Converting a multi-line string to a single line
Then you likely don't have an array.
- Fri Jan 20, 2023 2:32 pm
- Forum: PowerShell
- Topic: Trouble Converting a multi-line string to a single line
- Replies: 4
- Views: 975
Re: Trouble Converting a multi-line string to a single line
To turn an array into a list do the following: $array -join '.' This will separate each element of the array into a comma separated list. I recommend taking some time to learn how to work with strings in PowerShell. The following free book will help you learn PowerShell basics. https://www.sapien.co...
- Fri Jan 20, 2023 10:14 am
- Forum: PowerShell
- Topic: need help with regex
- Replies: 3
- Views: 419
Re: need help with regex
I see no way to solve your issue without changing code when you want to detect new languages. Try to rethink your process and question. Perhaps you will be able to clarify what you are trying to do.
- Thu Jan 19, 2023 3:36 pm
- Forum: PowerShell
- Topic: need help with regex
- Replies: 3
- Views: 419
Re: need help with regex
Just detect the string language you want.
if ($line -match 'English'){
#do something
}else($line -match 'French')
}
Use one line for each language you need to detect. You can do this in a loop with an array of lines.
if ($line -match 'English'){
#do something
}else($line -match 'French')
}
Use one line for each language you need to detect. You can do this in a loop with an array of lines.
- Tue Jan 17, 2023 9:57 am
- Forum: PowerShell
- Topic: Copy-Item copying folder and files but files are locked
- Replies: 14
- Views: 1003
Re: Copy-Item copying folder and files but files are locked
Logging open handles for the folder and files would be the best way to proceed. This will tell you what process has opened and locked the files.
- Mon Jan 16, 2023 6:52 pm
- Forum: PowerShell
- Topic: Copy-Item copying folder and files but files are locked
- Replies: 14
- Views: 1003
Re: Copy-Item copying folder and files but files are locked
If the share is part of a replication set then this can happen on busy networks. I would start by restarting the server as things can get out of sync. The network techs should be advised as to this condition as they would know more about the configuration of the servers and any replication that may ...
- Sat Jan 14, 2023 1:56 pm
- Forum: PowerShell
- Topic: expirate date to exe
- Replies: 2
- Views: 524
Re: expire date to exe
I am not sure what you are trying to ask but there is no "Expire Date" on Windows files.