Jump to content

Run this program when


utuser12

Recommended Posts

Hi

 

I'm trying to get a script running when a state changes. I have some trouble with powershell and spaces in the directory.

 

I know this have been discussed some time now. But i have some strange behavior::

 

powershell -ExecutionPolicy Unrestricted -nologo -noprofile -noexit -file C:\script\Test-Args.ps1  "%D"
Then i get the directory as one string with a " at the end.
 
powershell -ExecutionPolicy Unrestricted -nologo -noprofile -noexit -file C:\script\Test-Args.ps1  "%D
Then i get the directory as one string.
 
powershell -ExecutionPolicy Unrestricted -nologo -noprofile -noexit -file C:\script\Test-Args.ps1  "%D "%N
Then i get the directory and Name as one long string
 
powershell -ExecutionPolicy Unrestricted -nologo -noprofile -noexit -file C:\script\Test-Args.ps1  %D
Then i get a string for every space.
 

powershell -ExecutionPolicy Unrestricted -nologo -noprofile -noexit -file C:\script\Test-Args.ps1  "%D;%S;%N

I get one long string spaced by ;, this is what im using now as i can split it in powershell. But does anyone know why this strange behavior occurs?
 
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...