中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-24 13:06
47,811 topics / 349,909 posts / today 0 new / 48,262 members
WinPE、PowerShell及其它命令行系统专区 » Problems with PowerShell running
Printable Version  3,023 / 2
Floor1 hepimg2001 Posted 2010-07-14 10:42
新手上路 Posts 3 Credits 4
Dear great experts:

I run the following script:
cmd /c powershell.exe -WindowStyle Hidden -NonInteractive -command {$hklm = "HKEY_LOCAL_MACHINE" ;$key = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Wireless-101_is1" ;$value = "InstallLocation" ;$a=([Microsoft.Win32.Registry]::GetValue("$hklm\$key",$value,$null) + 'bin\App.exe') ;& $a}。
The function of this script is to query the registry and then run the application in the installation path.

Now the problem is: If it is run in PowerShell under Win7, after entering the PowerShell interface, running this script is OK, and the application can be called correctly.
But: If it is run in cmd in Win7, entering the normal command line interface, running this script has problems.

If in the cmd interface, run the cmd /c powershell command once first, and then run this script, there is no problem.

Hope that great experts can give advice!
Floor2 hepimg2001 Posted 2010-07-14 15:39
新手上路 Posts 3 Credits 4
Which expert has research on this thing?
Floor3 hepimg2001 Posted 2010-07-14 15:42
新手上路 Posts 3 Credits 4
Or other methods to achieve the following functions can also be used:

Need to obtain the application installation path by querying the registry in the CMD interface, and then start this application. For example: cmd /c powershell.exe -command “& {…………}”
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023