You are right
Kudos
How to use paths with pauses in PowerShell code inserted to VBS file?
Re: How to use paths with pauses in PowerShell code inserted to VBS file?
To include pauses in PowerShell code inserted into a VBS (VBScript) file, you can use the `Start-Sleep` cmdlet in PowerShell to introduce delays. Here's an example of how you might structure it:
```powershell
# PowerShell code with pauses
$code = @"
# Your PowerShell code here
Write-Host "Executing Step 1"
Start-Sleep -Seconds 5
Write-Host "Executing Step 2"
Start-Sleep -Seconds 10
Write-Host "Executing Step 3"
"@
# Save the PowerShell code to a VBS file
$code | Out-File -FilePath "C:\Path\To\Your\Script.vbs"
```
In this example, the `Start-Sleep` cmdlet is used to introduce pauses between different steps in your PowerShell code. Adjust the `-Seconds` parameter to specify the duration of the pause in seconds.
This PowerShell script will then be saved to a VBS file, which can be executed using the Windows Script Host (`cscript.exe` or `wscript.exe`). Remember to change the file path to your desired location.
```powershell
# PowerShell code with pauses
$code = @"
# Your PowerShell code here
Write-Host "Executing Step 1"
Start-Sleep -Seconds 5
Write-Host "Executing Step 2"
Start-Sleep -Seconds 10
Write-Host "Executing Step 3"
"@
# Save the PowerShell code to a VBS file
$code | Out-File -FilePath "C:\Path\To\Your\Script.vbs"
```
In this example, the `Start-Sleep` cmdlet is used to introduce pauses between different steps in your PowerShell code. Adjust the `-Seconds` parameter to specify the duration of the pause in seconds.
This PowerShell script will then be saved to a VBS file, which can be executed using the Windows Script Host (`cscript.exe` or `wscript.exe`). Remember to change the file path to your desired location.