Kind Regards.
powershell missing closing ')' because of bracket in username
106 Views Asked by Hige Mynx At
1
There are 1 best solutions below
Related Questions in WINDOWS
- how to play a sounds in c# forms?
- Echo behaviour of Microsoft Windows Telnet Client
- Getting error while running spark-shell on my system; pyspark is running fine
- DirectX 9 With No SDK Installed - How To Translate a D3DMATRIX?
- Gradle 8.7 cannot find installed JDK 22 in IntelliJ
- 'IOException: The cloud file provider is not running', when trying to delete 'cloud' folder
- Cannot load modules/mod_dav_svn.so into server
- Issue with launching application after updating ElectronJs to version 28.0.0 on Windows and Linux
- 32-bit applications do not display some files in Windows 10
- 'bun' is not recognized as an internal or external command
- mkssecreenshotmgr taking a screenshot
- Next js installation in windows 7 os
- Can't resize a partition using Mini Tool?
- Is there any way to set a printer as default according with Active Directory Policy Security Group and PC hostname?
- Electron Printing not working on Windows (Works on Mac)
Related Questions in POWERSHELL
- PowerShell Linphone Configuration
- How avoid \t being converted to Tab in Powershell
- How do I get my terminal to work in VS Code? Exit Code:2, doesn't allow me to type anything
- Npm command not working in powershell but works in cmd
- Issue with path not being treated as encapsulated when calling cmd /C
- Native command throws error only when I redirect to a variable
- Logic Apps and long running Azure Function (Powershell)
- April fools - PsExec (PsTools)
- How to use nested ForEach-Object
- Batch Script-Powershell MessageBox | How do I set TopMost within PS command line of Batch?
- Execution Stuck at Get-PnPPage if function executed on Button Click
- How can I expand a column from group output?
- How to use expression in regex -replace with capturing group in powershell
- powershell where-object -cnotmatch filter unwanted lines
- How to make Visual Studio 2022 project launch Windows Terminal instead of PowerShell?
Related Questions in ENVIRONMENT-VARIABLES
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Windows environment variables at appsettings.json
- API key 401 error in .env.development file
- Vite TypeError: Cannot read properties of undefined (reading 'VITE_YOUTUBE_API_KEY')
- Set environment variable during push for GitHub Actions
- Is there a way to read .csproj PropertyGroup variable in c#
- My environment variables are not recognized in Azure - ASP.NET Core MVC
- Is it best to declare global variables in a header file or environment file in a C project
- NextJS public environment variables are not recognized in my elastic beanstalk
- Shell script for copying environment variables into config.json?
- Locally testing OS environmental variables in Ballerina
- Is using NEXT_PUBLIC for my secret key is a dangerous way to use environment variables when I deploy on vercel?
- can't add another folder path in environment variables
- How to use ProxyAgent with http_proxy and no_proxy environment variables
- New values not being loaded for .env for SvelteKit app
Related Questions in PARENTHESES
- Why is time complexity of Generate Parentheses O(4^n ( sqr root( n)))
- How do I create a column in R with a "yes" output if any of the selected columns are "yes"
- C-style vs Function-style: Best Cast for the Unused Variable/Function Warning
- The C# switch statement and parentheses
- Convert prefix to infix with minimum number of parentheses
- Groovy code fail when debugging in IntelliJ IDEA
- Why is '(x in list_1) == True' is True but 'x in list_1 == True' is False?
- Error when not using named parameters when calling a function reference
- using sep argumnt to put double rounded parenthesis
- Is there any difference between using "content = { }" parameter or directly "{}" in Jetpack Compose?
- I have an error in BigQuery Sql while following teacher's post to make a temp table, it doesn't like the parentheses and I don't know why?
- Trying to figure out how to handle math expression including parentheses
- Match functions with more than two arguments with Regex
- Regex - Matching an optional group of text within parentheses including parenthese themselves - while grouping
- Case when RLIKE
Related Questions in WINDOWS-11
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- OpenSubKey() in Windows 11
- Is there an easy way to open PowerShell in admin mode for the current folder on Windows 11?
- What is going on?
- MAUI App needs double clicks to open from task bar when minimized on Windows 11, need to open it in single click like other apps
- How to Fix C# WinForms Application Not Loading correctly on Windows 11?
- Explorer.exe keep writes registry entry silently upon right click on certain file types
- Open apps on main monitor even when the main monitor reassigned windows 11
- Open files in new tabs in Kate
- Python - Subprocess Output on Windows
- "I can't install the SDK file for the DigitalPersona 4500 fingerprint reader on Windows 11
- How do I write a hexadecimal value to the registry?
- A way to directly open 'Cleanup recommendation' settings GUI, from Command prompt (or) powershell
- Issues setting up LibTorch on Windows 11
- Windows 11 - How to modify the title of a group of items in the Windows Explorer context menu?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?

You're calling
powershell.exefrom PowerShell:First, the question is why you're calling another instance of PowerShell in order to execute a script file (
*.ps1). You could just invoke it directly, which is not only simpler, but faster, due to running in-process ( a(in the user name reflected in$env:USERPROFILEis then not a problem):If you do need another instance - such as if you're calling from PowerShell (Core) 7+, but your script only works in Windows PowerShell - use a script block (
{ ... }), which not only avoids your problem, but also preserves rich data-type support for both input and output (within the constraints of the XML-based cross-process serialization that happens behind the scenes).As for what you tried:
If you specify neither
-Filenor-Commandwithpowershell.exe,-Commandis implied (note that forpwsh.exe, the PowerShell (Core) 7+ CLI, it is now-File).What follows
-Command, after removal of (unescaped)"during command-line parsing, is then interpreted as PowerShell code.Because you're calling from PowerShell and are using an expandable (double-quoted) string (
"..."), the reference to environment variable$env:USERPROFILEis expanded before the child process sees the resulting command-line string, which is the source of your problem:PowerShell ends up executing something like
& C:\User\user(a\..., which - due to the unescaped(- causes a syntax error.Therefore, there are two solutions (though the script-block technique shown above is still preferable:
Either: Use
'...'rather than"..."around the (implied)-Commandargument.Or: Escape the
$in$env:USERPROFILEas`$to prevent premature expansion (this is helpful if you need selective up-front expansion):An alternative, as iRon points out, is to use the
-Fileparameter:What is passed to
-File- both the script file path itself and any subsequent pass-through arguments, are not subject to another round of interpretation as PowerShell code, so the(in the environment-variable value doesn't cause a problem.For detailed guidance on when to use
-Filevs.-Command, see this answer.