I am trying to just make a directory, but I cannot figure it out. I am trying to make a template so I want everything in the program to reference the form name. I am using Powershell Studio to write this program.
This does not work (Desired method):
$FormName = $formChangeMe.Text | out-string
$PATHDIR = ($env:USERPROFILE + "\AppData\Local\Tools\" + $FormName)
md -Force $PATHDIR
Output from $PATHDIR
returns C:\\Users\\Username\\AppData\\Local\\Tools\\ChangeMe
but it wont make the directory.
This does work:
$PATHDIR = "C:\Users\Username\AppData\Local\Tools\ChangeMe"
md -Force $PATHDIR
I cant see why the one works and the other doesn't. I don't think I understand when to use ()
vs ''
vs ""
.
$FormName = ($formChangeMe.Text | out-string).Trim()
-感谢Matt!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.