Search found 5 matches

by EvzenP
05 Nov 2016 06:49
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 26
Views: 73324

Re: Powershell2/bat hybrid?

I'm having weird issue with "current directory" when the following hybrid batch is executed from directory containing opening square bracket in its name. When run e.g. from "te[]st" directory, the result of Get-Location is "C:\Windows\SysWOW64\WindowsPowerShell\v1.0" (I...
by EvzenP
25 Sep 2016 12:09
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 26
Views: 73324

Re: Powershell2/bat hybrid?

Ah, looks like I can answer myself - the brianddk 's method described in http://www.dostips.com/forum/viewtopic.php?p=45502#p45502 is the way. The problem I was having with this was that I did not get the idea properly - the whole point is that the PS code should be actually written as a function......
by EvzenP
25 Sep 2016 09:12
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 26
Views: 73324

Re: Powershell2/bat hybrid?

Okay, so this is simulating the param()... but how about actually having the param() fully functional... e.g. including parameter attribute and its arguments (like Mandatory, HelpMessage, ParameterSetName, etc.) or ability to define "switch" type parameters? I would really like to be able ...
by EvzenP
23 Sep 2016 00:56
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 26
Views: 73324

Re: Powershell2/bat hybrid?

<# : ------------ start batch part ------------ @echo off set PSModulePath=D:\Documents\WindowsPowerShell\Modules;%PSModulePath% :: PowerShell location set POWERSHELL=%windir%\system32\WindowsPowerShell\v1.0\powershell.exe :: 32-bit version needs to be used on 64-bit systems! if exist "%windir...
by EvzenP
20 Sep 2016 13:07
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 26
Views: 73324

Re: Powershell2/bat hybrid?

I tried various hybrid PS/BAT techniques described here, but I can't get the embedded PowerShell script to work properly with named parameters. I.e. that I could call my hybrid batch like e.g. foo.cmd -computerName MYHOMEPC -action MyAction If the PS code in foo.cmd declares parameters like param($c...