I'm using SAS 9.1 on Windows Server 2003 Standard Edition. I'm trying to run two programs in a batch mode. My .bat file contains exactly two rows:
Start "D:\PROGRAM FILES\SAS\SAS 9.1" -SYSIN "C:\MyFolder\prog1.sas"
Start "D:\PROGRAM FILES\SAS\SAS 9.1" -SYSIN "C:\MyFolder\prog2.sas"
After I double-click on the .bat file icon, the following message appears: "Windows cannot find 'SYSIN'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search".
How could this be fixed?
Thank you.
Typically you would have your SAS executable be part of the line - not just the folder (and that's likely not the right folder, though I don't recall the 9.1 folder structure - and please, please upgrade from 9.1, that's over a decade old).
Since you don't include anything with a .exe (or .com/etc.) extension, Windows probably is assuming the folder you put there is supposed to be the "Title" argument to the START command.
Include the full path to SAS.EXE including SAS.EXE itself, and see if that does what you need. If not, try removing START as that may be confusing things.
See Batch Processing Under Windows and the first listing under Four ways to schedule SAS tasks for more information.
I guess you want the two programs to run in parallel since you are using START? You need to add a title as the second argument, just insert "SAS" after START like this:
Start "SAS" "D:\PROGRAM FILES\SAS\SAS 9.1" -SYSIN "C:\MyFolder\prog1.sas"
Start "SAS" "D:\PROGRAM FILES\SAS\SAS 9.1" -SYSIN "C:\MyFolder\prog2.sas"
Ah, looking at Joe's answer, you probably need to add sas.exe to the command as well.
Removing leading "Start " and adding ".exe" to the command is sufficient:
"D:\PROGRAM FILES\SAS\SAS 9.1\sas.exe" -SYSIN "C:\MyFolder\prog1.sas"
"D:\PROGRAM FILES\SAS\SAS 9.1\sas.exe" -SYSIN "C:\MyFolder\prog2.sas"
(Thanks to all who answered here and to KurtBremser from the SAS Community.)
Related
So I was wanting to create a small batch file which runs a command line dialogue and launches various programs when my computer starts up. More for fun then practical uses really. My problem is that windows doesn't seem to be able to find some files despite my opening the file path in command prompt itself and copying the file path. It just gives me a "The system cannot find the file specified error."
Here's the relevant code for the batch file now edited for better readability (sorry about that):
//Works
start "" "C:\Program Files\Rainmeter\Rainmeter.exe"
//Also works
"G:\Steam\Steam.exe"
//Everything below this fails
"C:\Program Files(x86)\Google\Chrome\Application\chrome.exe"
"C:\Program Files(x86)\Razer\Synapse\RzSynapse.exe"
"C:\Program Files(x86)\eclipse\eclipse.exe"
"G:\Steam\steamapps\common\AdVentureCapitalist\adventure-capitalist.exe"
The first two files, rainmeter and steam, open fine, but everything past that fails. I've tried using both "Filepath" and start "" "Filepath", but neither seems to work. despite both working in the code above.
And, just to clarify, I have double and triple checked the file paths to make sure I didn't get something wrong, but it's just not working.
Thanks for any assistance that can be provided.
If you can provide which ones doesn't open it would be great.
"C:\Program Files(x86)\Google\Chrome\Application\chrome.exe"
Just like how people mentioned in your post comment there should be a space in between Program Files and (x86)
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Feel free to make use of env variables.
%programfiles% ==> C:\Program Files
%programfiles(x86)% ==> C:\Program Files (x86)
"%programfiles(x86)%\Google\Chrome\Application\chrome.exe"
I'm in Windows 7. I have an executable. I put it somewhere. I put this location in my path. Now I can start it from anywhere using cmd. I have a different location where I work containing files the .exe will process. I shift right-click to open cmd in the work location. I can run the exe, but the exe starts in its own location and can't find the files. If I were to create a windows shortcut to it, I would get a "start in" field, which would work. But I do this a lot from many different locations and I don't want to create a shortcut in each location. How do I do this on the command line without creating a shortcut? It would be great if I could just run something like
progam /startin .
What is the actual syntax?
#echo off
setlocal
pushd "c:\where\you\want\to\start"
programname
popd
This is the basic structure.
Redirecting CMD Commands To An EXE File
Long story short, basically I have the problem that every time I run BCDedit on the .BAT that I converted into an .EXE it never worked and I thought that the reason why it wasn't work was because it wasn't on Path but my Path was fine and even if it was on Path is set by default thanks to foxidrive.
Now my main problem is that is there a way I can convert it to an .EXE file with every single command working, is there a technique I could use to get BCDedit working as an .EXE file?
All of the commands do work it just BCDedit and I say if every single command would work so if somebody has a similar command problem like me they know how to figure it out, it works perfectly as batch but is there a way I can convert it and make BCDedit still work as an .EXE?
Please answer As Soon As Possible and if you want to take a look at my Path and Batch the visit the link at the top.
Thank you so much!
Compile this batch file and see if it works:
#echo off
bcdedit /?
pause
Then try this version:
#echo off
c:\Windows\System32\bcdedit.exe /?
pause
Just as the SysWow64 Redirection link you listed states. If you want a x86 application to call the 64-bit system directory you need to call the bcdedit application as follows.
%SystemRoot%\SysNative\bcdedit
This is because of Windows backwards compatibility measures, it is looking at C:\Windows\SysWOW64 instead of C:\Windows\System32. Another alternative would be to compile the script as both x86 and 64-bit, but then you could only use each on the respective systems.
Update for Comments
Even though the path is correct, an x86 application will execute commands or batch scripts against the C:\Windows\SysWOW64\cmd.exe which will cause the path redirection issue. Example to illustrate my point. On a 64-bit version of Windows, open C:\Windows\SysWOW64\cmd.exe and using Windows explorer create two unique files , one is C:\Windows\System32\unique_test64.txt and the other in C:\Windows\SysWOW64\unique_test86.txt. Now on the x86 command prompt enter if exist C:\Windows\System32\unique_test86.txt echo true. You will see that it is being redirected to SysWOW64 and will print true. And if you enter if exist C:\Windows\System32\unique_test64.txt echo true, nothing will be found.
Screenshot Example: http://i.imgur.com/K4kkI29.png
For example, I have 2 exe's. Let's call them 1.exe and 2.exe, to keep it simple.
And I want to make a zip file, with 3 things in it, 1.exe, 2.exe and setup.bat.
First off, I want to know that the user is okay that we start the first exe (1.exe). So we type:
#echo off
cls
echo Are you sure you want to install 1.exe?
echo If not, click exit right now. If you are okay with it,
pause
Here comes the first question. So we want to start 1.exe. How do I start 1.exe, that is in the same folder as the bat file?
Okay, lets continue. When 1.exe is finished, I want to copy 2.exe, place it in %appdata%, and then add it to startup. And that's the second question. How do i do that.
So the questions are:
How do I start 1.exe, which is in the same map as setup.bat
How do I copy 2.exe which is in the same map as setup.bat to %appdata%
How do I properly add 2.exe which is in %appdata% now to startup?
Note: Just using C:\documents and settings\all users\desktop\1.exe isn't going to work. I want it to work in all sorts of languages, and in some languages the folders might be called different.
1.exe will run 1.exe, just like on the command line.
copy 2.exe %appdata% will copy 2.exe.
I don't know what question 3 means.
Define "work in all sorts of languages"? If you need to pass in an argument to the batch file, do so: http://commandwindows.com/batch.htm
You are right you should never hard code "Documents and Settings" or "Program Files" in a BAT file, because these folder names don't "work in all sorts of languages". You need to refer to them using special folder ids or environment variables.
In your case, you need to create a program shortcut (.LNK file) in the startup folder. There are two parts.
creating a shortcut. Unfortunately there is no way to create a shortcut using only windows commands. You need to rely on a third party tool, there are many free command line tools that may do it; or write your own.
locating the Startup folder and placing the shortcut there. There are two startup folders. The common startup and the user startup folder. Choose one. Then, you need to use either the %ALLUSERSPROFILE%\Start Menu\Programs\StartUp or the %USERPROFILE%\Start Menu\Programs\StartUp.
So putting all pieces together in your SETUP.BAT , it would look something like this...
#echo off
echo Are you sure you want to install 1.exe?
echo If not, click exit right now. If you are okay with it,
pause
1
copy 2.exe %appdata%
makelink %appdata%\2.exe %USERPROFILE%\Start Menu\Programs\StartUp\2.lnk
One suggestion. Avoid all this mess. It seems to me that you need to install a program. If so, I'd recommend you to try Inno Setup. http://www.jrsoftware.org/ .
Inno Setup is a free installer for Windows. First introduced in 1997, Inno Setup today rivals and even surpasses many commercial installers in feature set and stability.
...
Supports creation of a single EXE to install your program for easy online distribution. Disk spanning is also supported.
Standard Windows 2000/XP-style wizard interface.
Customizable setup types, e.g. Full, Minimal, Custom.
Complete uninstall capabilities.
Installation of files: Includes integrated support for "deflate", bzip2, and 7-Zip LZMA/LZMA2 file compression. The installer has the ability to compare file version info, replace in-use files, use shared file counting, register DLL/OCX's and type libraries, and install fonts.
Creation of shortcuts anywhere, including in the Start Menu and on the desktop.
Creation of registry and .INI entries.
Running other programs before, during or after install.
...
This should do what you want.
#echo off
cls
echo Are you sure you want to install 1.exe?
echo If not, click exit right now. If you are okay with it,
pause
start /wait 1.exe
xcopy 2.exe %appdata% /y
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "2" /d %appdata%\2.exe
The last line will make a reg entry instead of copying it to the startup folder which will not create a shortcut on the desktop and you don't need anything more than batch.
I'm trying to automate a VB6 build where different apps are built from the same source by:
Changing "Conditional Compilation Arguments".
"Make Project" to a different executable name.
I can do part of this on the command line:
VB6.EXE /m Project.VBP /d BUILD_OTHER_APP=1
but the executable still has the name "Project.exe". If I rename the .EXE it stops working (doesn't seem to run). VB6 doesn't seem to have a command line option to set the executable name and I can't get round this problem with renaming.
I'm using VB6 on Win7 32-bit.
If you run VB6 /? from the command line a dialog box pops up to tell you all the options, and no, it seems that there isn't an option to specify the output filename.
I can't as yet see any reason for a rename to stop an executable working, but I'll try this later on today on Win XP.
The other workaround to renaming is to move the executables into folders of different names and create shortcuts or batch files of different names to call the correct executable.
edit: I'm working on Win XP and these two solutions are available to me:
Rename the executable - You might be able to develop on XP and run on Win7?
Add the .exe name to the build command line. This does override the .vbp:
VB6 /m Project1 /d conHello=-1 Hello.exe
VB6 /m Project1 /d conHello=0 World.exe
The hack that we are forced to do to create a different named output (and to change other aspects of the project) is to create a copy of the VBP (Project_tmp.vbp), and then change the name in the copy and build from that copy.