You need to separate the arguments from the file path:
powershell.exe -noexit "& 'D:\Work\SQLExecutor.ps1 ' -gettedServerName 'MY-PC'"
Another option that may ease the syntax using the File parameter and positional parameters:
powershell.exe -noexit -file "D:\Work\SQLExecutor.ps1" "MY-PC"
Related Posts:
- Create an empty file on the commandline in windows (like the linux touch command)
- How do I create a Batch file to change an exe installer to Win XP SP3 compatibility mode and launch installer
- xcopy returns error “Invalid number of parameters” when exclude parameter is set
- Curl not recognized as an internal or external command, operable program or batch file
- Redirecting Output from within Batch file
- How does the echo command works in batch programming
- How do I start PowerShell from Windows Explorer?
- What does “@” mean in Windows batch scripts
- How to run a PowerShell script
- How to list files in windows using command prompt (cmd). I’ve tried using ‘ ls ‘ as in Linux but it shows an error?
- Setting Windows PowerShell environment variables
- How to run a PowerShell script
- How can I open a cmd window in a specific location?
- How to solve “The directory is not empty” error when running rmdir command in a batch script?
- Need to navigate to a folder in command prompt
- Batch script loop
- How to force `findstr` to ignore `Cannot open` returns
- How to open an elevated cmd using command line for Windows?
- ‘openssl’ is not recognized as internal or external command
- While loop in batch
- XCOPY: Overwrite all without prompt in BATCH
- How to send a simple email from a Windows batch file?
- How can I run a program from a batch file without leaving the console open after the program starts?
- What does /p mean in set /p?
- How do I get the current username in Windows PowerShell?
- False ‘Sharing Violation’ Xcopy error message
- batch file from scheduled task returns code 2147942401
- How to split large text file in windows?
- CALL command vs. START with /WAIT option
- BAT file to map to network drive without running as admin
- How do I use spaces in the Command Prompt?
- Calling dir in cmd prints out: “Volume in drive C has no label.”
- Difference between $? and $LastExitCode in PowerShell
- Need auto-restart script in batch for minecraft server
- How to use random in BATCH script?
- How do I force Robocopy to overwrite files?
- Windows batch – concatenate multiple text files into one
- How to set commands output as a variable in a batch file
- Batch command for ImageMagick to convert all files in a directory and sub-directories on windows
- Best practice for exiting batch file?
- how to empty recyclebin through command prompt?
- Why is “MINGW64” appearing on my Git bash?
- Using %PROGRAMFILES(x86)% on Windows OS 32bit
- how to get program files x86 env variable?
- Difference between masm32 and masm?
- PowerShell says “execution of scripts is disabled on this system.”
- PowerShell says “execution of scripts is disabled on this system.”
- A fatal error occurred while creating a TLS client credential. The internal error state is 10013
- What are good grep tools for Windows? [closed]
- How to run powershell script from .ps1 file?
- How do I install and use cURL on Windows?
- Can’t connect to MySQL server on ‘localhost’ (10061) after Installation
- ow can I find where Python is installed on Windows?
- Can’t connect to MySQL server on ‘localhost’ (10061) after Installation
- Why is Windows 32-bit called Windows x86 and not Windows x32?
- ” is not recognized as an internal or external command, operable program or batch file
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- “X does not name a type” error in C++
- what is a “dump file” in windows task manager?
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- How do I run Redis on Windows?
- Rainbow Matrix CMD
- ” is not recognized as an internal or external command, operable program or batch file
- Python virtualenv questions
- Using putty to scp from windows to Linux
- Difference between xcopy and robocopy
- How to “comment-out” (add comment) in a batch/cmd?
- ‘npm’ is not recognized as internal or external command, operable program or batch file
- how to open an mp3 file with c
- What languages are Windows, Mac OS X and Linux written in?
- The filename, directory name, or volume label syntax is incorrect inside batch
- Bat file to run a .exe at the command prompt
- How to run a makefile in Windows?
- Command Prompt “Net View System Error 6118”
- git clone: Authentication failed for
- How to compile LEX/YACC files on Windows?
- How to run ‘sudo’ command in windows
- How to exit Python script in Command Prompt?
- Python command not working in command prompt
- How do I test if Python is installed on Windows (10), and run an exe to install it if its not installed?
- What is the ‘realtime’ process priority setting for?
- Windows equivalent to UNIX pwd
- Verify return code: 20 when testing OpenSSL
- Command ‘ls’ not working in command prompt
- Command line for looking at specific port
- How to uninstall a Windows Service when there is no executable for it left on the system?
- openssh windows bad owner or permissions
- What is the default password for Postgres
- “X does not name a type” error in C++
- Windows Activator .bat Text
- How To Activate Windows 10
- ‘npm’ is not recognized as internal or external command, operable program or batch file
- “rm -rf” equivalent for Windows?
- “rm -rf” equivalent for Windows?
- how to edit or see the source code for dll files
- PermissionError: [WinError 5] Access is denied python using moviepy to write gif
- What is the difference between Cygwin and MinGW?
- Text editor to open big (giant, huge, large) text files
- How to find the Windows version from the PowerShell command line
- UnicodeDecodeError: ‘charmap’ codec can’t decode byte X in position Y: character maps to