Fix running multiple cmdlets on windows (#6968)