China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-24 15:37
中国DOS联盟论坛 » WinPE、PowerShell及其它命令行系统专区 » Problems with PowerShell running View 3,027 Replies 2
Original Poster Posted 2010-07-14 10:42 ·  IANA 局域网IP(Private-Use)
新手上路
Credits 4
Posts 3
Joined 2010-07-13 15:27
16-year member
UID 170524
Gender Male
Status Offline
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!
Floor 2 Posted 2010-07-14 15:39 ·  IANA 局域网IP(Private-Use)
新手上路
Credits 4
Posts 3
Joined 2010-07-13 15:27
16-year member
UID 170524
Gender Male
Status Offline
Which expert has research on this thing?
Floor 3 Posted 2010-07-14 15:42 ·  IANA 局域网IP(Private-Use)
新手上路
Credits 4
Posts 3
Joined 2010-07-13 15:27
16-year member
UID 170524
Gender Male
Status Offline
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 “& {…………}”
Forum Jump: