damienvanrobaeys / Run-in-Sandbox

Run PS1, VBS, CMD, EXE, MSI, Intunewin, MSIX, or extract ISO, ZIP in Windows Sandbox very quickly just from a right-click
https://www.systanddeploy.com/2023/06/runinsandbox-quick-way-to-runextract.html
763 stars 86 forks source link

Error when attempting to run .ps1 file #11

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hello,

When I am trying to set up this useful modification, when I execute the single .ps1 script in the sources folder, it gives me a list of errors. How can I solve these?


Split-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\ProgramData\Run_in_Sandbox\RunInSandbox.ps1:18 char:39
+     $FolderPath = Split-Path (Split-Path "$ScriptPath" -Parent) -Leaf
+                                          ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Split-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Spli
   tPathCommand

Get-Item : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\ProgramData\Run_in_Sandbox\RunInSandbox.ps1:19 char:29
+     $DirectoryName = (get-item $ScriptPath).DirectoryName
+                                ~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-Item], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.GetI
   temCommand

Get-Item : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\ProgramData\Run_in_Sandbox\RunInSandbox.ps1:20 char:24
+     $FileName = (get-item $ScriptPath).BaseName
+                           ~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-Item], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.GetI
   temCommand

Get-Item : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\ProgramData\Run_in_Sandbox\RunInSandbox.ps1:21 char:29
+     $Full_FileName = (get-item $ScriptPath).Name
+                                ~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-Item], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.GetI
   temCommand

& : The term 'C:\Users\Arshan\Desktop\.wsb' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\ProgramData\Run_in_Sandbox\RunInSandbox.ps1:275 char:3
+ & $Sandbox_File_Path
+   ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Arshan\Desktop\.wsb:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
ghost commented 3 years ago

Any updates?

damienvanrobaeys commented 3 years ago

I updated the project, the main file is not RuninSandbox. You have to download the full project including folder sources and Add_Structue.ps1