Try this:
& "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe" PCNAME
To PowerShell a string “…” is just a string and PowerShell evaluates it by echoing it to the screen. To get PowerShell to execute the command whose name is in a string, you use the call operator &
.
More Related Contents:
- how do I pass a range of values on the command line – passing an expression as an argument
- Different behaviour and output when piping in CMD and PowerShell
- Running a powershell command using full path and arguments from command line [duplicate]
- Watch file for changes and run command with powershell
- How can I pass an argument to a PowerShell script?
- CMD pipe different form Powershell pipe?
- Escaping the and (&) sign in Powershell
- How to run an application as “run as administrator” from the command prompt? [closed]
- How to create a shortcut using PowerShell
- Visual studio code cmd error: Cannot be loaded because running scripts is disabled on this system
- How can I run a PowerShell script with white spaces in the path from the command line?
- How to run an installation in /silent mode with adjusted settings
- CMD or Powershell command to combine (merge) corresponding lines from two files [duplicate]
- PowerShell The term is not recognized as cmdlet function script file or operable program
- Run Executable from Powershell script with parameters
- Determine installed PowerShell version
- How do I pass multiple parameters into a function in PowerShell?
- Use Invoke-WebRequest with a username and password for basic authentication on the GitHub API
- How can I force Powershell to return an array when a call only returns one object?
- When should I use Write-Error vs. Throw? Terminating vs. non-terminating errors
- How to run a PowerShell script within a Windows batch file
- Saving credentials for reuse by powershell and error ConvertTo-SecureString : Key not valid for use in specified state
- How to use the curl command in PowerShell?
- Ignoring an errorlevel != 0 in Windows PowerShell (ISE)
- Loading Assemblies from NuGet Packages
- Output file doesn’t match Write-Host
- Powershell: resolve path that might not exist?
- How do I move a file to the Recycle Bin using PowerShell?
- Can you redirect Tee-Object to standard out?
- dotnet ef scaffold Unrecognized option ‘-t firstTable -t secondTable’ – pass arguments stored in a string